Background: This is the costfunction of Mean Regularized Multi Task Learning. This is a typical linear regression learning model, with the only difference being that there's multiple instances of trainings going on at the same time. So X has an additional 3rd dimension and W and Y a 2nd dimension. X is training data, Y is targets, W is weights, m is number of tasks (3rd dimension), d is number of features, n is number of examples.
$X\in R^{n_i\times d \times m}$, $Y\in R^{n_i\times m }$, $W\in R^{d \times m}$

Question: Given the cost function
$$ J =\min_W \frac{1}{2}||XW-Y||_F^2+\lambda\sum_{i=1}^m||W_i-\frac{1}{m}\sum_{s=1}^mW_s||^2_2 $$ What is $\frac{\partial}{\partial W}J$?
I need to calculate the partial derivatives that can be used with steepest gradient descent optimization algorithm. I was thinking of calculating the derivative both with respect to a single weight, and the whole matrix. See my answer for my calculations so far.