MACHINE LEARNING/Student Engineering Notebook
Page 09·notes
SUPPORT VECTOR MACHINES (SVM) & KERNEL METHODS—~30 MIN READ

The Kernel Trick, Mercer's Theorem & RBF Kernels

“Inner products in Hilbert spaces, Polynomial kernels, Gaussian RBF, and Mercer positive semi-definiteness.”

1.The Power of Mercer Kernels in High Dimensions

When data is not linearly separable in the original input space R^d (e.g. concentric circles or the XOR problem), we map samples into a higher-dimensional feature space R^D via non-linear mapping phi(x).

Why Explicit Mapping Fails: Computing phi(x) explicitly in 10,000 dimensions is computationally intractable in time and memory.

The Kernel Miracle: Notice that in the SVM dual formulation, features appear ONLY through the dot product x_i^T x_j. By substituting K(x_i, x_j) = phi(x_i)^T phi(x_j), we perform optimal maximum margin separation in an infinite-dimensional space while computing only simple scalar distances in original O(d) time!

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATION

2. Worked Practice Problem: Polynomial Kernel Explicit Mapping Verification

⚠️ Pitfall Warning:

Remember the sqrt(2) scaling factor on cross-terms when deriving the explicit feature vector phi(x).

Problem: For 2D vectors x = [x1, x2]^T and z = [z1, z2]^T, show that the kernel K(x, z) = (x^T z)^2 corresponds to an explicit 3D feature mapping phi(x).

Step 1: Expand the algebraic dot product:

x^T z = x1 z1 + x2 z2

Step 2: Square the sum:

(x^T z)^2 = (x1 z1 + x2 z2)^2 = (x1 z1)^2 + 2 (x1 z1)(x2 z2) + (x2 z2)^2

= (x1^2) (z1^2) + [ sqrt(2) x1 x2 ] [ sqrt(2) z1 z2 ] + (x2^2) (z2^2)

Step 3: Define explicit mapping phi(x):

phi(x) = [ x1^2, sqrt(2) x1 x2, x2^2 ]^T

Step 4: Verify dot product:

phi(x)^T phi(z) = x1^2 z1^2 + 2 x1 x2 z1 z2 + x2^2 z2^2 = (x^T z)^2 = K(x, z).

Conclusion: K(x, z) maps 2D coordinates into a 3D parabolic feature space where quadratic boundaries become linear hyperplanes.

WORKED NUMERICAL · STUDENT DERIVATION✎ Key Takeaway: The kernel computes φ(x)·φ(z) without ever building φ. The RBF kernel corresponds to an infinite-dimensional φ.

Worked example: what a polynomial kernel computes

Problem Statement:
In 2D, the kernel K(x, z) = (x·z + 1)² corresponds to a feature map φ. How many dimensions does φ have?
Step 1: Expand

(x₁z₁ + x₂z₂ + 1)² gives terms in x₁², x₂², x₁x₂, x₁, x₂ and 1.

Step 2: Match a feature map

φ(x) = (x₁², x₂², √2x₁x₂, √2x₁, √2x₂, 1).

Step 3: Count

6 features.

↳ Result: 6
Final Answer:6 dimensions
STUDENT PRACTICE · CONCEPT DRILL

Practice: test yourself

Original practice questions in the GATE style, with worked explanations. Not past-paper questions.

Problem 1 · TRICKY

A valid kernel's Gram matrix must be:

Problem 2 · GATE-LEVEL

In the RBF kernel exp(−γ‖x − z‖²), a very large γ makes the model:

Problem 3 · FOUNDATION

The kernel trick works because the SVM dual depends on the data only through:

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Kernel Methods for Pattern Analysis ·
LECTURE SERIES