Logistic regression
Logistic regression maps an affine score to a class probability. Its decision boundary is a hyperplane in the features supplied to it. Nonlinear input features can therefore give a nonlinear boundary in the original coordinates.
3.1 Probability, odds and threshold
Use labels , a feature vector , weights , intercept , and score . The score is dimensionless; if a raw feature has units, its weight has reciprocal units.
A unit increase in feature , holding others fixed, multiplies the odds by . It does not add to the probability. With false-positive cost , false-negative cost and zero correct-decision cost, the minimum expected-cost threshold is for calibrated posterior probabilities.
3.2 Likelihood and optimisation
Let and let contain the feature rows. Observations are conditionally independent in the likelihood. Below, collect labels and probabilities.
The Hessian is positive semidefinite, so the objective is convex. This does not guarantee a finite unregularised optimum: on strictly separable data, scaling a separating score can drive the loss towards zero with unbounded coefficients. Positive regularisation prevents that weight divergence; degeneracies involving an unpenalised intercept still require care, for example a training set containing only one class.
Last-minute recall
- Sigmoid returns a probability, not a numerical regression target.
- The affine score equals log odds.
- A probability threshold other than one-half shifts the boundary.
- The cross-entropy score derivative is .
- Convexity does not imply a finite unregularised solution on separable data.