diff --git a/ex2/costFunction.m b/ex2/costFunction.m index 1f49581..017299c 100644 --- a/ex2/costFunction.m +++ b/ex2/costFunction.m @@ -21,7 +21,7 @@ grad = zeros(size(theta)); % J = 1/m * (-y'*log(sigmoid(X*theta)) - (1-y)'*log(1-sigmoid(X*theta))); - +grad = 1/m * X' * (sigmoid(X*theta) - y);