Everything in this part comes together for one job: score a loan applicant's risk across more than two categories, using probabilities a lender could actually act on. Get the regularization wrong, though, and the model doesn't just get less accurate — it stays just as confident while being wrong, which is a far more dangerous failure in a system making real lending decisions.
4 of 4 applicants correctly classified at this λ
Four applicants, three risk classes, one softmax classifier. At λ=0 every prediction matches the true risk. Push λ up and watch predictions start flipping to the wrong class — while the probability bars stay just as confident-looking as before.
The engine is multinomial logistic regression — softmax over a per-class linear score — with the same weight-shrinkage mechanism from the ridge chapter applied to every class's weights at once:
- — class 's unregularized weight vector, over the applicant's features.
- — class 's bias — left unpenalized, exactly as in the ridge and lasso chapters.
- — the shrinkage strength; this form is ridge's own closed-form shrinkage in the special case of standardized, uncorrelated features.
- — the calibrated probability applicant belongs to risk class .
- Regularization here isn't about sparsity — it's about calibration
Unlike lasso, nothing here is meant to zero out; the goal is to keep any one class's weights from dominating the score purely due to unconstrained magnitude.
- Softmax doesn't know the weights were regularized
Softmax just normalizes whatever logits it's handed — it has no way to flag "these logits came from an over-shrunk model" versus "these logits are trustworthy." A miscalibrated model can look exactly as confident as a good one.
- Over-regularization has a real direction of failure here
As every class's weights shrink toward zero, the classifier increasingly falls back on each class's bias alone — and the bias ranking (low > medium > high) means over-shrinking systematically under-estimates risk, not randomly misclassifies it.
accuracy: 1/4 — average confidence in the winning class: 78.1%
Watch accuracy and average confidence side by side as λ moves. Accuracy falls off a cliff between λ=0.2 and λ=0.3 — but average confidence barely moves, staying in the 70s-to-80s percent the entire time. Confidence alone would never warn you that the model just started getting people wrong.
Bao: debt ratio 5, 0 late payments — a lender's judgment: medium risk.
- At λ=0.2, correctly medium — but barely
Shrunk weights give logits (low, medium, high) = . Exponentiate each:
Dividing by the sum : — medium wins, but by a margin of less than 0.08.
- At λ=0.3, that thin margin flips
Logits become — low has overtaken medium. Exponentiate each:
Dividing by the sum : . Bao is now predicted low risk: an under-flagged applicant, purely from one notch more shrinkage.
- Confidence gives no warning either way
Bao's top-class probability is right before the flip and right after — essentially unchanged. The model is equally "sure" of two opposite answers.
Pick the λ that still classifies all 4 applicants correctly.
A calibrated multi-class scorer combines softmax's normalized probabilities with regularization's weight control — but calibration is not accuracy. This toy engine stays confidently wrong across a wide range of over-shrunk λ, which is exactly why choosing λ needs a real accuracy check, not a glance at how sure the model sounds.