Logistic Regression Models
moar wrods
Likelihood
The likelihood for logistic regression models begins with the
Bernoulli distribution, since the response variable is binary,
known as the sigmoid function, or the cumulative distribution function of the logistic distribution.
In logistic regression, we treat the probability
Suppose we have
Numerically Stable Log-Likelihood
Simplifying the expression above using properties of the natural log
and
Using properties of the natural log, we find
Substitute in
When looking at the above expression, remember that we're using
The form above can be simplified further using properties (of the
common implementation) of the function
log1p
Gradient of Log-Likelihood
If you find yourself cross-checking the simplified log-likelihod in Julia/Python/R/what-have-you, then
-
don't forget
: most numerical software has minimization routines, so you should minimize the negative log-likelihood, , -
the gradient
helps.
Let