Kernels let SVM draw nonlinear boundaries while keeping the margin idea.
When a straight line fails, SVM can compare points in a transformed feature space using a kernel function.
When linear fails
Nonlinear question
Can one straight line separate points arranged like an inner circle and outer circle?
Some datasets are not linearly separable in the original feature space. A linear SVM will underfit.
Feature mapping idea
Transformation question
Could the same data become separable after adding new features?
A feature map transforms input \(x\) into a new representation \(\phi(x)\).
SVM can learn a linear boundary in the transformed space:
In original space, that may look like a curve.
Kernel trick
Computation question
Do we need to explicitly create all transformed features?
No. A kernel computes the inner product in transformed space directly.
This lets SVM work with rich transformations without manually constructing every transformed feature.
Polynomial kernel
Curved-boundary question
What if interactions like \(x_1^2\), \(x_2^2\), or \(x_1x_2\) help separate the classes?
| Parameter | Meaning |
|---|---|
| \(d\) | degree of polynomial flexibility |
| \(\gamma\) | scales the dot product |
| \(r\) | constant term |
RBF kernel
Similarity question
What if nearby points should strongly influence each other, and far points should barely influence each other?
The RBF kernel measures local similarity.
| Distance | RBF similarity | Meaning |
|---|---|---|
| small | close to 1 | points strongly influence each other |
| large | close to 0 | points barely influence each other |
Role of gamma
Overfitting question
What happens if each point only influences a tiny neighborhood?
| Gamma | Boundary | Risk |
|---|---|---|
| small \(\gamma\) | smooth, broad influence | underfitting |
| large \(\gamma\) | wiggly, local influence | overfitting |
C and gamma together
Tuning question
Can high \(C\) and high \(\gamma\) together memorize the training data?
Yes. \(C\) controls tolerance for violations. \(\gamma\) controls locality. High values for both can produce a very flexible boundary.