zl程序教程

您现在的位置是:首页 >  其它

当前栏目

[Machine Learning] Cost Function for Logistic Regression Model

for Function model learning MACHINE Regression Logistic cost
2023-09-14 08:59:13 时间

We cannot use the same cost function that we use for linear regression because the Logistic Function will cause the output to be wavy, causing many local optima. In other words, it will not be a convex function.

 

non-convex:

 

convex:

 

Instead, our cost function for logistic regression looks like:

 

 

If our correct answer 'y' is 0, then the cost function will be 0 if our hypothesis function also outputs 0. If our hypothesis approaches 1, then the cost function will approach infinity.

If our correct answer 'y' is 1, then the cost function will be 0 if our hypothesis function outputs 1. If our hypothesis approaches 0, then the cost function will approach infinity.

Note that writing the cost function in this way guarantees that J(θ) is convex for logistic regression.