Logistic regression

binary classification:

  • 0: Negative class
  • 1: Positive class

logistic regression model:

Sigmoid function(Logistic function):

So,

Interpretations of Hypothesis output

  • estimate probability that on input

Interpretations: Probability that , given , parameterized by

Example:
Interpretations: 70% chance of the tumor being malignant

Decision Boundary

  • decision boundary is a property not of the training set but of the hypothesis and the parameters
  • the training set is used to fit the parameters
  • the parameters is used to define the decision boundary
  • Suppose

predict if
predict if

Logistic regression_第1张图片
image.png

we can see in the figure above:

  • when then
  • when then , and predict
  • when then , and predict

An example of define decision boundary(parameters are certainly)

Logistic regression_第2张图片
image.png
  • if we has chose the parameters as follow:

  • predict: when
  • means , then we can get the purple line in the figure as above
  • the decision boundary is

Cost function in logistic regression

  • if , we can plot the figure as below:
    Logistic regression_第3张图片
    y1.png

1.
2. (we will penalized learning algorithm a very large cost)

  • if , we can plot the figure as below:
    Logistic regression_第4张图片
    image.png

1.
2. (we will penalized learning algorithm a very large cost)

Simplified cost function and gradient descent


  • Now we simplified the :

  • So, the cost function is:

  • Now, we use gradient descent to get :

Repeat

(Simultaneously update all )

你可能感兴趣的:(Logistic regression)