Linear regression outputs any number at all. What if the answer you actually want is a probability — something that has to stay between 0 and 1?
Drag the point along the curve. Near the middle it swings quickly from "probably not" to "probably so" — but far to either side, it barely moves at all, no matter how much further you drag.
That S-shaped squashing function is the sigmoid —
- — the sigmoid function: squashes any real number into a probability between 0 and 1.
- — the raw input score being squashed, before it's turned into a probability.
- Applied to the same linear score
Feed in the same linear score from Chapter 1 of this part, . Together, turns any real number into a valid probability.
- Where it crosses 0.5 is the decision boundary
The point where crosses exactly — where — is the decision boundary.
Drag and and watch the boundary itself move: shifts it sideways, controls how sharply the curve turns from 0 to 1 around it.
With :
- Evaluate at x = 5
, so exactly — the boundary.
- Evaluate at x = 8
, so — confidently on the "yes" side.
Balance w and b until the decision boundary — where P = 0.5 — lands exactly at x = 5.
Logistic regression is linear regression's score, squashed into a probability. Its derivative is exactly the chain rule from Part I — applied to a line, differentiated as . Next: the loss function built specifically for this kind of output.