From 10ef3bd80e7f85e55b4181948327484774158b00 Mon Sep 17 00:00:00 2001 From: neingeist Date: Thu, 27 Nov 2014 23:50:42 +0100 Subject: [PATCH] Regularized Gradient --- ex8/cofiCostFunc.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ex8/cofiCostFunc.m b/ex8/cofiCostFunc.m index 0f171af..b482f45 100644 --- a/ex8/cofiCostFunc.m +++ b/ex8/cofiCostFunc.m @@ -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; % =============================================================