This commit is contained in:
2017-05-28 06:50:45 +09:00
parent b4c0085bfb
commit fd8432ccbf
7 changed files with 34 additions and 11 deletions

View File

@@ -20,8 +20,10 @@ grad = zeros(size(theta));
% Note: grad should have the same dimensions as theta
%
hx = sigmoid(X*theta);
J = sum(-y.*log(hx) - (1.-y).*log(1.-hx))/m;
grad = sum((hx-y).*X)/m;