Back to Classic ML Mind Map
中文·English
📊 Classic MLID: kernel-trick

Kernel Trick & RBF

核技巧与 RBF
🎯Core Definition
SVM's dual optimization and prediction only depend on sample inner products xiTxjx_i^Tx_j. The kernel trick computes inner products in a high- (even infinite-) dimensional feature space directly via K(x,z)=ϕ(x),ϕ(z)K(x, z) = \langle\phi(x), \phi(z)\rangle without ever constructing ϕ\phi — as long as KK is a Mercer kernel (symmetric PSD). Common kernels: linear K=xTzK = x^Tz, polynomial K=(xTz+c)dK = (x^Tz + c)^d, and the RBF Gaussian kernel K(x,z)=exp(γxz2)K(x, z) = \exp(-\gamma\Vert x - z\Vert^2) with bandwidth γ=12σ2\gamma = \frac{1}{2\sigma^2}: larger γ\gamma gives more complex boundaries (overfitting), smaller gives smoother ones (underfitting). The kernelized decision function is f(x)=iSVαiyiK(xi,x)+bf(x) = \sum_{i \in SV} \alpha_i y_i K(x_i, x) + b at O(nSVd)O(n_{SV} \cdot d) cost, independent of the feature-map dimension.
💡Use Cases
the weapon of choice for non-linearly separable data; interviews probe γ\gamma/σ\sigma tuning direction, kernel-to-feature-map correspondence (polynomial kernel → (n+dd)\binom{n+d}{d} dims, RBF → infinite-dim RKHS), and why kernel methods scale with data size.
Key Problems Solved
explicit feature maps explode in dimension (quadratic polynomial map is O(d2)O(d^2)-dimensional) and can be infinite (RBF expands via Taylor as eγxz2=eγx2eγz2k(2γxz)kk!e^{-\gamma\Vert x-z\Vert^2} = e^{-\gamma\Vert x\Vert^2} e^{-\gamma\Vert z\Vert^2} \sum_k \frac{(2\gamma x \cdot z)^k}{k!}, an infinite-dimensional feature space); the kernel computes the same inner product in O(d)O(d) on the raw inputs, giving 'linear SVM + kernel' non-linear power — training needs only the Gram matrix Kij=K(xi,xj)K_{ij} = K(x_i, x_j), dual and prediction read only inner products/kernel values, decoupled from feature dimension; valid kernels are closed under sums/scales/products (Mercer), so domain kernels (e.g. string kernels for text) can be designed freely.
🎯5 High-Frequency Exam Points
1
Derive RBF as an infinite-dimensional map: expand eγxz2=eγx2eγz2k(2γxz)kk!e^{-\gamma\Vert x-z\Vert^2} = e^{-\gamma\Vert x\Vert^2} e^{-\gamma\Vert z\Vert^2} \sum_k \frac{(2\gamma x \cdot z)^k}{k!} to expose the features.
2
Mercer's theorem: what makes a valid kernel (symmetric PSD)? Which functions are invalid? Prove sums/products of kernels stay kernels.
3
Derive the explicit feature dimension of the polynomial kernel K=(xTz+c)dK = (x^Tz + c)^d (e.g. (n+dd)\binom{n+d}{d}) and how the kernel avoids building it.
4
RBF tuning: bias-variance behavior as γ\gamma (or σ\sigma) grows/shrinks, interplay with CC; which direction to move each under under/overfitting?
5
Which algorithms are kernelizable (need only inner products/norms) and which are not? Linear vs RBF when dd is large or nn is small?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Kernel Trick & RBF"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardSoft Margin & HingeNext CardDecision Tree Splitting

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient