BRAGA

02 Writing02-02 Notes02-02-467

Soft Margin Optimization (Primal)

Published 16 Apr 20263 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
min⁡w,b,ξ  12∥w∥2+C∑i=1nξi\displaystyle \min_{w,b,\xi}\; \frac{1}{2}\|w\|^2 + C\sum_{i=1}^{n}\xi_i
(1)

We are working on the primal soft-margin optimization problem for a linear Support Vector Machine in non-separable classification. The canonical formulation 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
(2)

subject to

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

where yi∈{−1,+1}y_i \in \{-1,+1\}, the slack variables ξi\xi_i measure margin violations, and C>0C>0 controls the tradeoff between a wide margin and tolerance for classification errors.

Deep Breakdown

Soft-margin optimization is the practical version of the linear Support Vector Machine, SVM, used when the training data is not perfectly linearly separable. In real business datasets, this is the normal case. Customers, campaigns, fraud events, churners, converters, and defect states rarely fall into two perfectly separated clouds. Some points overlap, some are noisy, and some are outright mislabeled. The hard-margin SVM requires all points to satisfy:

yi(w⊤xi+b)≥1y_i(w^\top x_i + b) \ge 1
(4)

That only works when perfect separation exists. Soft-margin SVM relaxes this by introducing slack variables ξi\xi_i, one per observation:

yi(w⊤xi+b)≥1−ξiy_i(w^\top x_i + b) \ge 1 - \xi_i
(5)

with

ξi≥0\xi_i \ge 0
(6)

This allows some observations to:

  • lie inside the margin,
  • sit exactly on the wrong side of the margin boundary,
  • even be misclassified.

The optimization objective 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
(7)

This has two competing parts:

  1. Margin term:
12∥w∥2\frac{1}{2}\|w\|^2
(8)

Smaller ∥w∥\|w\| means a larger geometric margin.

  1. Violation penalty:
C∑i=1nξiC\sum_{i=1}^{n}\xi_i
(9)

Larger slack values mean more severe margin violations or misclassifications.

Inputs:

  • feature vectors xi∈Rdx_i \in \mathbb{R}^d,
  • labels yi∈{−1,+1}y_i \in \{-1,+1\},
  • penalty parameter CC.

Outputs:

  • weight vector ww,
  • intercept bb,
  • slack variables ξi\xi_i,
  • a separating decision rule:
y^=sign⁡(w⊤x+b)\hat{y} = \operatorname{sign}(w^\top x + b)
(10)

Why it matters in DA/DS:

  • it is the standard practical linear SVM formulation,
  • it handles noisy and overlapping classes,
  • it provides robust classification with controlled complexity,
  • it gives an interpretable tradeoff parameter CC,
  • it connects directly to hinge loss and regularized empirical risk minimization.

In business classification tasks such as churn prediction, fraud detection, customer intent classification, campaign-quality detection, and quality-control defect classification, perfect separation is unrealistic. Soft-margin SVM is therefore the operational formulation, not the exceptional one.

Flowchart

Start withlabeled data(x_i, y_i)Assume classesmay overlapDefine lineardecision functionf(x) = w^T x + bIntroduce slackvariables ξ_i formarginviolationsSet constraintsy_i(w^T x_i + b)≥ 1 - ξ_i and ξ_i≥ 0Build objective(1/2)||w||^2 + CΣ_i ξ_iOptimize over w,b, and ξObtainmaximum-margin classifier withviolationsallowedInterpret C astradeoff betweenwide margin andpenalty strengthUse classifier forprediction andsupport-vectoranalysis

#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