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 γ.
The role of C
| Large (small ) | Small (large ) | |
|---|---|---|
| Margin | Narrow | Wide |
| Training violations | Few tolerated | Many tolerated |
| Bias / variance | Low bias, high variance (overfitting risk) | High bias, low variance (underfitting risk) |
| Support vectors | Fewer | More |
| Analogue | in ridge/LASSO | Large |
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.
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.
| Kernel | Boundary | |
|---|---|---|
| Linear | Straight line / hyperplane | |
| Polynomial | Polynomial curves of degree | |
| RBF (Gaussian) | Flexible, local "bumps" |
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
Kernels
Complexity knobs, all models
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.