|
|
|
@ -44,8 +44,13 @@ J = 0.5 * sum(sum(R.*(X*Theta'-Y).^2)) ...
|
|
|
|
|
+ 0.5 * lambda * sum(sum(Theta.^2)) ...
|
|
|
|
|
+ 0.5 * lambda * sum(sum(X.^2));
|
|
|
|
|
|
|
|
|
|
X_grad = (R.*(X*Theta'-Y))*Theta; % mov X user * uxer X feat = mov X feat
|
|
|
|
|
Theta_grad = (R.*(X*Theta'-Y))'*X; % user X mov * mov X feat = user X feat
|
|
|
|
|
% mov X user * uxer X feat = mov X feat
|
|
|
|
|
X_grad = (R.*(X*Theta'-Y))*Theta ...
|
|
|
|
|
+ lambda*X;
|
|
|
|
|
|
|
|
|
|
% user X mov * mov X feat = user X feat
|
|
|
|
|
Theta_grad = (R.*(X*Theta'-Y))'*X ...
|
|
|
|
|
+ lambda*Theta;
|
|
|
|
|
|
|
|
|
|
% =============================================================
|
|
|
|
|
|
|
|
|
|