From a score to a probability
The topic Linear classifiers and surrogate losses ended with a table of what each surrogate loss estimates. The hinge loss recovers only the side of the boundary. The logistic loss recovers the log-odds, and the probability itself follows from the log-odds.
Many decisions need that probability, not just the side. The previous topic's example was the chance of default against the price of a loan. Here take the churn task: a telecom offers a discount to customers who are likely to leave. Whether the discount pays off depends on how likely each customer is to leave, compared with what the discount costs. Logistic regression is the linear model built to output that probability.
In this topic the labels are , with for a customer who left. They suit the Bernoulli distribution. The margin form of the previous topic uses labels , which here are . The score is . To shorten the formulas, add a constant feature to every , so that the bias becomes one of the weights and .
Why not model the probability as a linear function? A linear score takes every real value, while a probability lives in , so a linear model would happily predict or . The odds live in , and the log-odds in . So the log-odds is a quantity a linear score can describe without leaving its range. Logistic regression sets it equal to the score:
The sigmoid is just the inverse of the log-odds. A score of means ; a score of gives , and a score of gives . Two properties of from the topic Derivatives and Taylor series in Mathematics for ML are used below: and .