AI Logistic Regression Tutorial: Binary Classifier

TL;DRLogistic regression predicts a probability for classification — despite the name.

It takes a linear combination of features and squashes it through a sigmoid into a 0-1 probability, then thresholds for a class. It's the workhorse binary classifier: interpretable, fast, well-calibrated, a strong baseline. "Regression" in the name refers to the underlying linear model; the task is classification. Extend to multi-class with softmax.

Key points

Common mistakes

Try it: Explain how the sigmoid turns a score into a probability.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>score = w·x + b → sigmoid → 0.83 probability
≥ 0.5 → class A, else class B</pre></body></html>
Open the interactive lesson →
Linear Regression · The Simplest Model Decision Trees · Gini · Entropy