Logistic Regression is an exceptional tool for the task of classification. It is particularly well-suited for scenarios where the outcome variable is categorical, such as determining whether an email is spam or not spam, or predicting whether a patient has a certain disease based on their symptoms.
Takes a probabilistic approach to learning discriminative functions (i.e. a classifier) from data.
should give us where
In plan English:
Much like linear regression at the end, but instead we pass it through the Sigmoid Function so as to squash the output to be between 0 and 1, representing a probability.
Decision Boundary
Predictions are made by applying a threshold to the output of the hypothesis function. A common threshold is 0.5:
Predict if
In plain english, if you can put a line between two classes, you can use logistic regression to classify them.
This line doesnt have to be flat or linear, could be a curve, or any shape really. As long as you can draw a line between the two classes.
Gradient Descent
- Initialize to some value (often zeros)
- Repeat until convergence
Where is the cost function:
Still quite similar to linear regression, but the cost function is different.