2.4.1 · HinglishSVM, Naive Bayes & Probabilistic Models

Support Vector Machine maximum margin concept

1,629 words7 min readRead in English

2.4.1 · AI-ML › SVM, Naive Bayes & Probabilistic Models

WHY: hum maximum margin kyun chahte hain?

Maano do classes linearly separable hain. Unhe perfectly separate (0 training errors) karne wali infinitely many lines hain. Kaun si "best" hai?

Jo points street ke edge ko touch karte hain wo support vectors hain. Sirf wohi boundary define karte hain — baaki sabhi points hata do aur answer same rahega.

WHAT: setup kya hai?

HOW: margin measure kaise karte hain? (Scratch se derive)

Step 1 — Ek point se hyperplane ki distance. Ek point lo. Plane ke perpendicular (yaani direction mein) distance chalke plane pe tak pahuncho: Ye step kyun? Kisi bhi plane tak sabse chhota rasta uske normal ke along hota hai.

apply karo aur use karo: Toh signed distance hai

Step 2 — Scale fix karo (wo clever trick). ko freely scale kiya ja sakta hai: aur same plane describe karte hain. Hum ye ambiguity scale choose karke hataate hain, jisse nearest points satisfy karein: Ye step kyun? Ye ek degree of freedom pin kar deta hai, ek messy ratio ko ek clean constraint mein badal deta hai. Yahi canonical hyperplane hai.

Step 3 — Margin width compute karo. Us scaling ke saath, nearest point ka hai, toh uski distance hai. Street dono sides pe itni hi hai:

HOW: support vectors kaise emerge hote hain? (KKT sketch)

Multipliers ke saath Lagrangian banao: Stationarity deta hai: Ye kyun matter karta hai: data points ka ek weighted sum hai. Complementary slackness kehta hai , toh sirf unhi points ke liye hai jo exactly margin pe hain (). Wohi support vectors hain; baaki sab ka hota hai aur wo dropout ho jaate hain.

Worked Examples

Common Mistakes (Steel-manned)

Recall Feynman: ek 12-saal ke bacche ko explain karo

Socho playground mein do groups of kids hain, aur tumhe ek seedhi line paint karni hai taaki har group apni side pe rahe. Tum kaafi saari lines paint kar sakte ho. Best line wohi hai jo dono groups ke beech sabse bada khali walkway chhodi, taaki agar koi kid thoda hilta bhi hai toh cross na kare. Jo kids walkway ke edge pe khade hain wo "important" kids hain — wohi decide karte hain line kahan jayegi. Pichhle hisse mein door khade sabhi kids bilkul matter nahi karte.

Flashcards

SVM sabhi separating hyperplanes mein se kya maximize karta hai?
Margin — dono classes ke nearest points tak perpendicular distance (sabse chaudi "street").
Canonical form mein margin width ka formula?
.
Max-margin hyperplane kis direction ke perpendicular hota hai?
Opposite-class points ke closest pair ko join karne wale vector ke (tightest gap) — aksar diagonal, koi axis nahi.
maximize karne ki jagah minimize kyun karte hain?
Dono equivalent hain; quadratic form convex aur differentiable hai, jo ek clean QP deta hai.
Canonical (scaling) constraint jo mein ambiguity hataata hai?
, yaani .
Support vectors kya hote hain?
Training points jo exactly margin edges pe hote hain (, ); sirf wohi boundary define karte hain.
ki jagah labels kyun use karte hain?
Taaki dono class constraints ek mein collapse ho jayein: .
Point se hyperplane tak distance?
.
Optimization ke baad, data ke kis combination ke barabar hota hai?
(support vectors par weighted sum).
Naye point ke liye decision rule?
.

Connections

  • Support Vector Machine soft margin (slack variables) — jab data separable nahi ho tab kya karein.
  • Kernel trick — nonlinear boundaries ke liye ko se replace karna.
  • Lagrangian duality and KKT conditions — support vectors formally kaise arise hote hain.
  • Logistic Regression — contrast: probabilistic vs margin-based; hinge loss vs log loss.
  • VC dimension and generalization bounds — large margin test error kyun bound karta hai.
  • Convex optimization / Quadratic Programming — SVM ke peeche ka solver.

Concept Map

SVM chooses

widest street between classes

better robustness

justified by

touch edge and define

signed distance

fix scale

gives

equals 2 over norm w

subject to

defines

Infinitely many separators

Maximum margin separator

Margin width

Better generalization

VC theory bound

Support vectors

Hyperplane w x plus b equals 0

r equals w x plus b over norm w

Canonical hyperplane min equals 1

Minimize half norm w squared

y_i w x plus b greater than or equal 1