Loss Function Explorer
Every loss is an opinion about error: MSE panics at outliers, MAE counts calmly, log-loss fears confident mistakes.
Tip: park the error at zero, drop the outlier, and watch the three means disagree.
Try this
- Run the panic test. Error at zero, then drop the +4.5 outlier: MSE leaps past 10 while MAE strolls to 2.25. Same data, different fears — the legend narrates it.
- Find Huber's hinge. Slide the error slowly from 0 to 3 and watch the mint curve: parabola until 1, straight line after. The kink at δ is the compromise made visible.
- Price certainty. Flip to classification with truth y = 1: push p to 0.99 and note the tiny bill — then drag to 0.01 and feel the explosion. Confidence cuts both ways.
How to read a loss
In regression, MSE squares each error — big misses dominate, so one outlier can shout down a hundred good predictions. MAE takes absolute values instead: every unit of error costs the same, outliers included. Huber splits the difference, quadratic near zero and linear beyond δ = 1.
In classification, log-loss charges −ln(probability of the truth): confident and right is nearly free, confident and wrong is catastrophic — far steeper than the dashed linear penalty beside it. That acceleration near certainty is why classifiers learn humility.
Compare what different losses penalize.
Move a prediction error and inspect how each loss responds. Use the study map to connect these curves to optimization and model fitting.
Create a free account All free tools
A free account opens the first 3 lessons of each subject. Other lessons require a subscription and their prerequisites.