foundation Estimated learning time: 6 h

5.3 Logistic regression and classification

You can build a calibrated binary classifier and read its coefficients.

Before:03. Data Handling & AnalysisUnlocks:06. Deep Learning10. Production & MLOps13. Capstones, Portfolio & Interviews

Logistic regression is the workhorse classifier and the cleanest bridge from linear models to neural networks: a sigmoid over a linear score, trained with cross-entropy. Done well it yields calibrated probabilities, which many fancier models do not. It follows linear regression as the classification twin. The fixation to break is the half-way threshold — the right cutoff depends on the costs of each kind of mistake, which makes it a business decision wearing a mathematical costume.

Work through these

  • Sigmoid, log-odds, decision boundary

    The function that squeezes any number into a probability, the log-odds scale where the model is linear, and the surface separating the classes. These three views of the same model reinforce each other.

  • Cross-entropy loss and its gradient

    The loss that follows from maximum likelihood for this model, and its gradient, which turns out to be strikingly simple. Deriving it once removes the mystery from classification training.

  • Multiclass: softmax, one-vs-rest

    Extending to more than two classes, either by a single function over all classes or by several binary models. The first is standard and the second still appears in libraries.

  • Threshold choice as a business decision

    The cutoff between predicted probability and predicted class is not a modelling decision but a decision about the cost of each kind of mistake. Leaving it at the default is a decision too, usually an unexamined one.

Sign in to keep your progress.

Free resources

Links last checked 29 Aug 2026.

Stuck here?

Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.

Checking your session…

Topics shown in module order.