Lesson 6.7 · 10 min read · about 55 min to master at a very slow pace

The C Parameter and Kernels

C trades margin width against training violations, exactly like an inverse regularisation strength. Kernels let an SVM draw curved boundaries by working in a richer feature space. Linear, polynomial and RBF kernels, and tuning C and γ.

Not startedJump to quiz

The role of C

Large (small )Small (large )
MarginNarrowWide
Training violationsFew toleratedMany tolerated
Bias / varianceLow bias, high variance (overfitting risk)High bias, low variance (underfitting risk)
Support vectorsFewerMore
Analogue in ridge/LASSOLarge

is a hyperparameter: choose it by cross-validation, on standardised features.

Direction check

multiplies the training error, while multiplies the penalty. So more means less regularisation. It's easy to get backwards.

Kernels: curved boundaries

If no straight line separates the classes, map into a richer feature space where a hyperplane does.

-2-1012
In 1-D, the outer class surrounds the inner one: no single cut-point separates them.
-2-1012x (vertical: x²)
Map x → (x, x²). Now a straight line (x² = 2.25) separates them perfectly.

The kernel trick makes this cheap. The SVM's solution only ever needs inner products between points, so we can use a kernel function that computes them directly, without ever building , which can even be infinite-dimensional.

KernelBoundary
LinearStraight line / hyperplane
PolynomialPolynomial curves of degree
RBF (Gaussian)Flexible, local "bumps"
Two concentric rings: hopeless for a linear SVM (or K-means), easy with an RBF kernel, which draws a closed curve around the inner class.

Tuning γ in the RBF kernel

  • Large γ: each training point's influence is very local, so the boundary is wiggly: low bias, high variance (overfitting).
  • Small γ: influence spreads far, so the boundary is smooth: high bias (underfitting).
  • Tune and together by cross-validation (e.g. a grid over both).

Practical notes

  • Standardise features: distances and inner products are scale-sensitive.
  • For class imbalance, use class weights (a bigger for the rare class).
  • Multi-class problems use one-vs-rest or one-vs-one combinations of binary SVMs.
  • Training cost grows quickly with , and probabilities need an extra calibration step.

Cheatsheet

Effect of C

Large C: narrow margin, few violations, low bias/high variance. Small C: wide margin, high bias/low variance. C ~ 1/λ.

Kernels

Linear · Polynomial · RBF .

Complexity knobs, all models

More complex: ↑ degree, ↑ #features, ↓ λ, ↓ K (K-NN), ↑ C, ↑ γ (RBF), ↑ tree depth.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1interpretWhat generally happens when you increase in a soft-margin SVM?
Q2conceptThe SVM's plays a role most like which quantity?
Q3conceptWhat does the kernel trick avoid?
Q4interpretAn RBF-kernel SVM uses a very large . What's most likely?
Q5applyTwo classes form concentric rings. Which method can separate them?