Write the hinge loss and the logistic loss as functions of the margin m=t f(x), where t∈{−1,+1} is the label and f(x) the classifier's score, and evaluate both at m=−1,0,1,2. What does the difference in their shapes mean for the classifiers they produce?

Supervised learning, Loss functions
Level L2 Elementary. Length Short. Nature Th+Mat Both.

What's being asked

Whether you can write both losses in terms of the margin and link their shapes to support vectors and probability outputs.

Key idea

The margin m is positive when the prediction is correct and larger when it is more confident. Hinge loss max⁡(0,1−m) is exactly zero once m≥1; logistic loss ln⁡(1+e−m) is positive for every m. So an SVM ignores confidently correct points, while logistic regression uses every point and gives probabilities σ(f(x)).

Steps

  1. Write both losses in terms of m and sketch them next to the zero-one loss 1[m≤0], which is 1 for a mistake and 0 otherwise.
  2. Fill in the table. Hinge gives 2,1,0,0. Logistic gives ln⁡(1+e)≈1.313, ln⁡2≈0.693, ln⁡(1+e−1)≈0.313 and ln⁡(1+e−2)≈0.127.
  3. Note what they share. Both are convex (bowl-shaped, so there are no bad local minima) and grow only linearly for very wrong points, so outliers hurt less than with squared loss.
  4. Hinge: the loss and its slope are zero for m≥1. So only points with m≤1, the support vectors, affect the solution.
  5. Logistic: smooth and never exactly zero. So every point has some influence, and the score can be read as a probability, P(t=1∣x)=σ(f(x)).

Common mistakes

How long your answer should be

3–5 sentences plus the table of values.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: A node holds 16 samples, 8 positive and 8 negative. Split A sends 6 samples (5 positive, 1 negative) left and 10 samples (3 positive, 7 negative) right. Split B sends 8 samples (6 positive, 2 negative) left and 8 samples (2 positive, 6 negative) right. What is the information gain (using base-2 entropy) of each split, and which split is chosen?
Next in Supervised learning: A feature x has class-conditional densities N(μ1=1,σ2=4) for class C1 and N(μ2=5,σ2=4) for class C2, with priors P(C1)=0.8 and P(C2)=0.2. For equal-variance 1-D Gaussians, the Bayes decision boundary is x∗=μ1+μ22+σ2μ2−μ1ln⁡P(C1)P(C2). What is x∗, which class is predicted for x=4, and how does the unequal prior shift the boundary?