机器学习 线性、逻辑回归

28. April 2018 深度学习 0

1.逻辑回归

h = sigmoid(X*theta);
theta1 = [0 ; theta(2:size(theta), :)];
p = lambda*(theta1’*theta1)/(2*m);
J = ((-y)’*log(h) – (1-y)’*log(1-h))/m + p;

grad = (X’*(h – y)+lambda*theta1)/m;

预测p=sigmoid(X*theta)>=0.5