cost1(theta'X)
cost2(theta'X)改为线性形式
h(x)不是概率,变为1,0
y(i)=1,h(x)>1时J=0
y(i)=0,h(x)<-1时,J=0
large margin
原来的cost funtion写成CA+B的形式,C取一个很大的值,最优化时A~0
数学本质:
(sum(theta(2:end,:).^2))/m 相当于theta列向量的模的平方
theta'*X是theta和X的点积
最小化(sum(theta(2:end,:).^2))/m使theta得模尽可能小
要保证theta'*X>1或<-1,X(i)在theta上的投影就要尽量大
高斯曲线:
x1,x2,...改为f1,f2...
f是相似度,=exp(-模的平方和/2*sigma^2)
sigma越大,柱体越粗,拟合不足
怎样获得l
取x(1),x(2)。。。为i(1),l(2)分别计算
如何训练theta:
最小化cost function ,ragularition项变为theta'*m*theta
theta的个数很多时,时间会变长