🌐
MathWorks
mathworks.com › statistics and machine learning toolbox › classification › support vector machine classification
loss - Find classification error for support vector machine (SVM) classifier - MATLAB
The hinge loss is approximately 0.3. Classifiers with hinge losses close to 0 are preferred. ... SVM classification model, specified as a ClassificationSVM model object or CompactClassificationSVM model object returned by fitcsvm or compact, respectively.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 399415-how-can-i-use-hinge-loss-for-multi-class-support-vector-machine-algorithm
How can I use Hinge loss for Multi-class Support Vector Machine algorithm? - MATLAB Answers - MATLAB Central
May 7, 2018 - I have coded a Multi-class SVM classifier using Hinge loss as loss function. I worked on the knowledge in this article: https://cs231n.github.io/linear-classify/. But instead of decreasing and c...
🌐
MathWorks
mathworks.com › statistics and machine learning toolbox › classification › neural networks
resubLoss - Resubstitution classification loss - MATLAB
This MATLAB function returns the Classification Loss by resubstitution (L), or the in-sample classification loss, for the trained classification model Mdl using the training data stored in Mdl.X and the corresponding class labels stored in Mdl.Y.
in machine learning, a loss function used for maximum‐margin classification
In machine learning, the hinge loss is a loss function used for training classifiers. The hinge loss is used for "maximum-margin" classification, most notably for support vector machines (SVMs). For an intended … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Hinge_loss
Hinge loss - Wikipedia
January 26, 2026 - The hinge loss is a convex function, so many of the usual convex optimizers used in machine learning can work with it. It is not differentiable, but has a subgradient with respect to model parameters w of a linear SVM with score function
🌐
arXiv
arxiv.org › pdf › 2103.00233 pdf
Learning with Smooth Hinge Losses Junru Luo ∗, Hong Qiao †, and Bo Zhang ‡
Hinge loss with these two smooth Hinge losses, we obtain two smooth support · vector machines (SSVMs) which can be solved with second-order methods. In · particular, they can be solved by the inexact Newton method with a quadratic ... This paper is organized as follows. In Section 2, we first briefly review several · SVMs ...
🌐
YouTube
youtube.com › watch
Introduction to Hinge Loss | Loss function SVM | Machine Learning - YouTube
Watch this video to understand the meaning of hinge loss and it is used for maximum - margin classifications for support vector machines.#hingelossfunction #...
Published   February 16, 2023
Find elsewhere
🌐
Programmathically
programmathically.com › home › machine learning › classical machine learning › understanding hinge loss and the svm cost function
Understanding Hinge Loss and the SVM Cost Function - Programmathically
June 26, 2022 - Sharing is caringTweetIn this post, we develop an understanding of the hinge loss and how it is used in the cost function of support vector machines. Hinge Loss The hinge loss is a specific type of cost function that incorporates a margin or distance from the classification boundary into the ...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 127933-libsvm-which-hinge-loss-function
LibSVM - Which hinge loss function? - MATLAB Answers - MATLAB Central
May 2, 2014 - I was wondering if anyone knows what hinge loss function LibSVM is using? I cannot find anything with Google, except that you can change the value of epsilon, if you are using the Epsilon SVR type.
🌐
NISER
niser.ac.in › ~smishra › teach › cs460 › 23cs460 › lectures › lec11.pdf pdf
HINGE LOSS IN SUPPORT VECTOR MACHINES Chandan Kumar Sahu and Maitrey Sharma
February 7, 2023 - For an intended output of t = ±1 and a classifier score y, the hinge loss of the prediction y is defined ... Note that y should be raw output of the classifier’s decision function, not the predicted class label. For instance, in linear SVMs, y = wT ·
🌐
Analytics Vidhya
analyticsvidhya.com › home › what is hinge loss in machine learning?
What is Hinge loss in Machine Learning?
December 23, 2024 - Theoretical Guarantees: Hinge loss is based on strong theoretical foundations in margin-based classification, making it widely accepted in machine learning research and practice. Robustness to Outliers: Outliers that are correctly classified with a large margin contribute no additional loss, reducing their impact on the model. Support for Linear and Non-Linear Models: While it is a key component of linear SVMs, hinge loss can also be extended to non-linear SVMs with kernel tricks.
🌐
Towards Data Science
towardsdatascience.com › home › latest › a definitive explanation to hinge loss for support vector machines.
A definitive explanation to Hinge Loss for Support Vector Machines. | Towards Data Science
January 23, 2025 - We see that correctly classified points will have a small(or none) loss size, while incorrectly classified instances will have a high loss size. A negative distance from the boundary incurs a high hinge loss.
🌐
GeeksforGeeks
geeksforgeeks.org › hinge-loss-relationship-with-support-vector-machines
Hinge-loss & relationship with Support Vector Machines - GeeksforGeeks
June 7, 2024 - Here we will be discussing the role of Hinge loss in SVM hard margin and soft margin classifiers, understanding the optimization process, and kernel trick.
🌐
GitHub
github.com › chibuta › hige-loss
GitHub - chibuta/hige-loss: Hige loss function matlab implemetation
When zi is linear in model parameters, then Hinge loss is convex in model parameters.
Author   chibuta
🌐
MathWorks
mathworks.com › matlabcentral › answers › 470021-backward-propagation-and-hinge-loss
Backward Propagation and Hinge Loss - MATLAB Answers - MATLAB Central
July 3, 2019 - Hi I plan to write a function which will output the derivative of a hinge loss w.r.t the ground truth. I consider the function as following from this link: + where as Y(the first parameter)is th...
🌐
Medium
koshurai.medium.com › understanding-hinge-loss-in-machine-learning-a-comprehensive-guide-0a1c82478de4
Understanding Hinge Loss in Machine Learning: A Comprehensive Guide | by KoshurAI | Medium
January 12, 2024 - In this example, we’ll use the popular scikit-learn library to create a support vector machine classifier with hinge loss. from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn.metrics import hinge_loss # Load the iris dataset for demonstration iris = datasets.load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2, random_state=42) # Create a support vector machine classifier with hinge loss svm_classifier = SVC(kernel='linear', C=1.0, loss='hinge') svm_classifier.fit(X_train, y_train) # Make predictions on the test set y_pred = svm_classifier.predict(X_test) # Calculate hinge loss loss = hinge_loss(y_test, y_pred) print(f'Hinge Loss: {loss}')
Top answer
1 of 2
9

Searching for the quoted text, it seems the book is Data Science for Business (Provost and Fawcett), and they're describing the soft-margin SVM. Their description of the hinge loss is wrong. The problem is that it doesn't penalize misclassified points that lie within the margin, as you mentioned.

In SVMs, smaller weights correspond to larger margins. So, using this "version" of the hinge loss would have pathological consequences: We could achieve the minimum possible loss (zero) simply by choosing weights small enough such that all points lie within the margin. Even if every single point is misclassified. Because the SVM optimization problem contains a regularization term that encourages small weights (i.e. large margins), the solution will always be the zero vector. This means the solution is completely independent of the data, and nothing is learned. Needless to say, this wouldn't make for a very good classifier.

The correct expression for the hinge loss for a soft-margin SVM is:

$$\max \Big( 0, 1 - y f(x) \Big)$$

where $f(x)$ is the output of the SVM given input $x$, and $y$ is the true class (-1 or 1). When the true class is -1 (as in your example), the hinge loss looks like this:

Note that the loss is nonzero for misclassified points, as well as correctly classified points that fall within the margin.

For a proper description of soft-margin SVMs using the hinge loss formulation, see The Elements of Statistical Learning (section 12.3.2) or the Wikipedia article.

2 of 2
1

The (A) hinge function can be expressed as

$$y_{i} = \gamma \max{\left(x_{i}-\theta, 0\right)} + \varepsilon_{i},$$

where:

  • $\gamma$ is the change in slope after the hinge. In your example, this amounts to the slope following the hinge, since your hinge-only model (see below) assumes zero effect of $x$ on $y$ until the hinge.

  • $\theta$ is the point (in $\boldsymbol{x}$) at which the hinge is located, and is a parameter estimated for the model. I believe your question is answered by considering that the location of the hinge is informed by the loss function.

  • $\varepsilon_{i}$ is some error term with some distribution.

Hinge functions can also be useful in changing any line:

$$y_{i} = \alpha_{0} + \beta x_{i} + \gamma \max{\left(x_{i}-\theta, 0\right)} + \varepsilon_{i},$$

where:

  • $\alpha$ is the model constant, and the intercept of the curve before the hinge (i.e. for $x < \theta$). Of course, if $\theta < 0$, then the curve intersects the $y$-axis after the hinge so $\alpha$ will not necessarily be the $y$-intercept of the bent line.
  • $\beta$ is the slope of the line relating $y$ to $x$
  • $\gamma$ is the change in slope after the hinge.

In addition, the hinge can be used to model how a functional relationship between $y$ and $x$ changes form, as in this model where the relationship becomes quadra

$$y_{i} = \alpha_{0} + \beta x_{i} + \gamma \max{\left(x_{i}-\theta, 0\right)^{2}} + \varepsilon_{i},$$

🌐
Stack Overflow
stackoverflow.com › questions › 56372258 › which-loss-function-to-implement-for-cnn-svm-infusion
matlab - Which loss function to implement for CNN-SVM infusion - Stack Overflow
My plan is to use CNN only as a feature extractor and use SVM as the classifier. (I know people have already implemented it a few years back either in tensor flow or in other platforms) Doing this, I got stuck in a point during backward propagation. In this phase, I got puzzled as which loss function I need to implement to upgrade the gradients and the parameters. ... I got a feeling to implement the hinge loss here.