logistic regression

cost function:

\(J(\theta)=\frac{1}{m}\sum_{i=1}^{m}Cost(h_\theta(x^{i}),y^{i})\)

\(Cost(h_\theta(x),y)=-ylog(h_{\theta}(x))-(1-y)log(h_{\theta}(x))\)

\(h_\theta(x)=\frac{1}{1+e^{-\theta^{T}.x}}\)

 

选择cost function的一个重要考虑是,选择的cost function必须是convex,这样很多求最优值的方法就能使用,比如gradient discent。

如果仿照linear regression的cost function,构建的logistic regression。

\(Cost(h_\theta(x),y)=(h_{\theta}(x)-y)^{2}\)

这个cost函数是non-convex

posted @ 2015-04-28 06:38  王剑飞  阅读(191)  评论(0编辑  收藏  举报