BRAGA

02 Writing02-02 Notes02-02-469

Unconstrained Hinge Formulation

Published 16 Apr 20263 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
min⁡w,b  12∥w∥2+C∑i=1nmax⁡(0,  1−yi(w⊤xi+b))\displaystyle \min_{w,b}\; \frac{1}{2}\|w\|^2 + C \sum_{i=1}^{n}\max\left(0,\;1-y_i(w^\top x_i+b)\right)
(1)

We are working on the unconstrained hinge-loss formulation of the linear Support Vector Machine, where the canonical objective is

min⁡w,b  12∥w∥2+C∑i=1nmax⁡(0,  1−yi(w⊤xi+b)).\min_{w,b}\; \frac{1}{2}\|w\|^2 + C \sum_{i=1}^{n}\max\left(0,\;1-y_i(w^\top x_i+b)\right).
(2)

This is the unconstrained version of the soft-margin SVM, under the assumptions of binary labels yi∈{−1,+1}y_i \in \{-1,+1\}, linear decision score w⊤xi+bw^\top x_i+b, and penalty parameter C>0C>0 controlling the tradeoff between margin size and violation cost.

Deep Breakdown

The unconstrained hinge formulation is one of the most practical ways to understand and implement a linear SVM. Instead of writing the model as a constrained optimization problem with slack variables, it rewrites everything as one objective function with no explicit inequality constraints.

The classical soft-margin primal SVM is:

min⁡w,b,ξ  12∥w∥2+C∑i=1nξi\min_{w,b,\xi}\; \frac{1}{2}\|w\|^2 + C\sum_{i=1}^{n}\xi_i
(3)

subject to:

yi(w⊤xi+b)≥1−ξi,ξi≥0y_i(w^\top x_i+b)\ge 1-\xi_i,\quad \xi_i \ge 0
(4)

That formulation is mathematically clean, but for implementation and optimization intuition, it is often more convenient to remove the slack variables explicitly. The key observation is that for fixed ww and bb, the smallest feasible slack is:

ξi=max⁡(0,  1−yi(w⊤xi+b))\xi_i = \max(0,\;1-y_i(w^\top x_i+b))
(5)

Substituting that into the objective gives the unconstrained formulation:

min⁡w,b  12∥w∥2+C∑i=1nmax⁡(0,  1−yi(w⊤xi+b))\min_{w,b}\; \frac{1}{2}\|w\|^2 + C \sum_{i=1}^{n}\max\left(0,\;1-y_i(w^\top x_i+b)\right)
(6)

This has two parts:

  1. Regularization term
12∥w∥2\frac{1}{2}\|w\|^2
(7)

This encourages smaller weights and therefore a larger margin.

  1. Empirical loss term
C∑i=1nmax⁡(0,  1−yi(w⊤xi+b))C \sum_{i=1}^{n}\max(0,\;1-y_i(w^\top x_i+b))
(8)

This penalizes points that are inside the margin or misclassified.

Why this matters in DA/DS:

  • it connects SVMs directly to loss-minimization language,
  • it makes SVMs look like other machine learning objectives,
  • it is easier to implement with gradient or subgradient methods,
  • it reveals hinge loss as the operational form of margin violations,
  • it bridges classical optimization and modern ML training workflows.

In practical terms, this formulation is what many implementations conceptually optimize, even if they use specialized solvers. It is also the most natural version for comparing SVMs to logistic regression and other regularized classifiers.

Flowchart

Start withlabeled data(x_i, y_i)Define linearscore f(x_i) =w^T x_i + bCompute signedmargin y_i(w^Tx_i + b)Compute hingeloss max(0, 1 -y_i(w^T x_i + b))Sum hingelosses across allobservationsAddregularizationterm (1/2)||w||^2Weight empiricalloss by COptimizeunconstrainedobjective over wand bObtainmaximum-margin classifier withsoft violationsUse sign(w^T x+ b) forprediction

#machine-learning#machine-learning-algorithms#support-vector-machines-svm-and-classification

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close