zoukankan      html  css  js  c++  java
  • [Machine Learning] Cost Function for Logistic Regression Model

    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.

  • 相关阅读:
    Docker
    Docker
    VIM
    Python
    Python
    VIM
    Python
    其他
    Java
    Java
  • 原文地址:https://www.cnblogs.com/Answer1215/p/13565666.html
Copyright © 2011-2022 走看看