Logistic Regression
Logistic Regression
1
Problem Setting
2
Problem Setting
● If the above probability is known for all K classes, we can predict the label as:
3
Assumption
4
Assumption
5
Fitting LR models
● We can optimize the above equation using any gradient descent based
algorithm.
6
Fitting LR model for 2 class setting
7
Fitting LR model for 2 class setting
Rearranging log-likelihood
8
Fitting LR model for 2 class setting
9
Fitting LR model for 2 class setting
● It is not easy to find beta, that satisfies the above equation. We can use an
iterative algorithm to find beta. One such algorithm is called Newton-Raphson
algorithm.
10
Fitting LR model for 2 class setting
Newton-Raphson method:
11
Fitting LR model for 2 class setting
Newton-Raphson method:
12
Fitting LR model for 2 class setting
13
Fitting LR model for 2 class setting
The above solution can also be obtained from solving weighted least square:
14
Summary
• Logistic Regression is a classification approach!
• Assumes that the class probabilities are given by a logit or sigmoid function.
15