BRAGA

02 Writing02-02 Notes02-02-464

Hard Margin Optimization

Published 16 Apr 20263 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
min⁡w,b12∥w∥2subject toyi(w⊤xi+b)≥1,  i=1,…,n\min_{w,b} \dfrac{1}{2}\lVert w \rVert^2 \quad \text{subject to} \quad y_i(w^\top x_i + b) \geq 1,\; i=1,\dots,n
(1)

We are working on the Hard Margin Optimization problem in Support Vector Machines, with canonical formula min⁡w,b12∥w∥2\min_{w,b} \dfrac{1}{2}\lVert w \rVert^2 subject to yi(w⊤xi+b)≥1y_i(w^\top x_i + b) \geq 1 for all i=1,…,ni=1,\dots,n, where xi∈Rpx_i \in \mathbb{R}^p are feature vectors, yi∈{−1,+1}y_i \in \{-1,+1\} are class labels, ww is the normal vector of the separating hyperplane, and bb is the intercept. The domain is binary linear classification with linearly separable data, where no training misclassifications are allowed and the goal is to maximize the geometric margin.

Deep Breakdown

Hard Margin SVM is the cleanest and most idealized version of Support Vector Machine classification. It assumes the dataset is perfectly linearly separable, meaning there exists at least one hyperplane that classifies every training point correctly.

A hyperplane in pp dimensions is defined by:

w⊤x+b=0w^\top x + b = 0
(2)

where:

  • ww determines the orientation of the boundary,
  • bb shifts the boundary.

For classification, we predict:

  • class +1+1 if w⊤x+b>0w^\top x + b > 0,
  • class −1-1 if w⊤x+b<0w^\top x + b < 0.

If the data is separable, many different hyperplanes may classify all points correctly. Hard Margin SVM does not choose just any separating hyperplane. It chooses the one with the largest margin, meaning the largest minimum distance from the boundary to any training point.

This is formulated as the optimization problem:

min⁡w,b12∥w∥2subject toyi(w⊤xi+b)≥1,  i=1,…,n\min_{w,b} \frac{1}{2}\lVert w \rVert^2 \quad \text{subject to} \quad y_i(w^\top x_i + b) \geq 1,\; i=1,\dots,n
(3)

The objective 12∥w∥2\frac{1}{2}\lVert w \rVert^2 is minimized because smaller ∥w∥\lVert w \rVert corresponds to a larger geometric margin. The constraints ensure all points are correctly classified and lie on the correct side of the margin boundary.

Why this matters in DA/DS:

  • Foundational model: it is the starting point for understanding soft-margin SVMs, hinge loss, and kernel SVMs.
  • Maximum-margin principle: it introduces the idea that among all perfect separators, the most robust one is preferred.
  • Convex optimization: the problem is a quadratic program with linear constraints.
  • Support vectors: only a subset of training points determines the boundary.
  • Generalization intuition: wider margin often improves out-of-sample robustness.

In practice, hard margin is rarely used directly because real business data almost always contains noise, overlap, or outliers. But conceptually it is the core from which the soft-margin SVM is built.

Flowchart

Start withlabeled trainingdata (x_i, y_i)Assume classesare linearlyseparableDefineseparatinghyperplane w^Tx + b = 0Imposeclassificationconstraintsy_i(w^T x_i + b)= 1Optimize min(1/2)||w||^2Obtainmaximum-margin separatinghyperplaneIdentify supportvectors on themarginboundariesUse hyperplanefor binaryclassification

#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