Hinge loss is what an SVM minimises. It doesn't want you merely correct — it wants you correct by a margin of at least 1, and stops caring the moment you clear it.
For labels y in {-1, +1} and a raw score s:
loss = max(0, 1 - y * s)
Task: write hinge_loss(scores, labels) returning the mean loss over all samples, rounded to 4 decimal places.
+1 or -1, not 1 and 0.The flat region is the interesting part. Once a point is correctly classified with margin, its loss and its gradient are both exactly zero, so it stops influencing the model entirely. Only the points near the boundary — the support vectors — shape the final decision surface.