demo · 02-ml-fundamentals
The kernel trick — lift to separate
Two classes in concentric rings. No line separates them in 2D. Apply φ(x,y) = (x, y, x²+y²) — the inner ring stays low, the outer ring lifts high. A horizontal plane separates them perfectly. Rotate the 3D view to see it from every angle.
Why it matters
The kernel trick lets SVMs (and other linear models) work in very high-dimensional feature spaces without ever computing the feature map explicitly. The RBF kernel K(x,z) = exp(−γ‖x−z‖²) corresponds to an infinite-dimensional φ — yet you only ever compute dot products. This demo shows the intuition with a 3D feature map you can see and rotate.
The math
φ(x, y) = (x, y, x² + y²) # explicit feature map
Separator in lifted space: x² + y² = threshold
↔ a circle in 2D (projected back)
RBF kernel (implicit, infinite-dim):
K(x, z) = exp(−γ ‖x − z‖²)
Anchored to 02-ml-fundamentals/supervised-learning.