완료
This commit is contained in:
@@ -36,10 +36,11 @@ grad = zeros(size(theta));
|
||||
% grad = grad + YOUR_CODE_HERE (using the temp variable)
|
||||
%
|
||||
|
||||
hx = sigmoid(X*theta);
|
||||
%J = sum(-y.*log(hx)-(1.-y).*log(1.-hx))/m + lambda*sum([0; theta(2:end)].^2)/(2*m);
|
||||
J = (-y'*log(hx)-(1.-y)'*log(1.-hx))/m + lambda*sum([0; theta(2:end)].^2)/(2*m);
|
||||
|
||||
|
||||
|
||||
|
||||
grad = X'*(hx-y)/m + lambda*[0; theta(2:end)]/m;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user