Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- h = sigmoid(X * theta);
- f = -y.*log(h);
- s = (1-y).*log(1-h);
- J = (f-s);
- grad = X'*(h - y);
- b = lambda/(2*m);
- c = theta .^ 2;
- J = a*sum(J)+b*sum(c);
- temp = theta;
- temp(1) = 0;
- grad = a*sum(grad) + sum(temp*lambda);
Add Comment
Please, Sign In to add comment