A linear classifier has and . What are the hinge loss and the 0–1 loss on the points with label , with label , and with label ?
Supervised learning, Hinge loss
Level L2 Elementary. Length Short. Nature Mat Mathematical.
What's being asked
Whether you can evaluate the hinge loss and see how it differs from the 0–1 loss.
Key idea
For a score and label , the hinge loss is . It is zero only when the point is correctly classified with a margin of at least 1.
Steps
- Write the score .
- Point : and . Hinge loss . The 0–1 loss is 0 because the sign is correct.
- Point : and . Hinge loss . The 0–1 loss is 0, because is on the right side but inside the margin.
- Point : and . Hinge loss . The 0–1 loss is 1 because the sign is wrong.
- Summarise: hinge loss also penalises correct points that are too close to the boundary (like ), and it grows linearly for wrong points. The 0–1 loss does neither.
Common mistakes
- Using instead of , so that negative-class points get the wrong sign.
- Saying has zero loss because it is classified correctly. The SVM wants a margin of 1, not just the right sign.
- Forgetting the bias when computing the score.
How long your answer should be
Three one-line calculations and a one-sentence comparison.
Read this
Previous in Supervised learning: A three-class softmax model produces scores (logits) for an input. Compute the class probabilities. If the true class is class 2, what is the cross-entropy loss, and what is the gradient of the loss with respect to ?
Next in Supervised learning: What is the difference between multiclass and multilabel classification, and how do the output activation, the loss and the prediction rule differ for a neural or linear model with outputs? What are three ways to reduce multilabel to simpler problems?