Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Two classic tools, now curved
Ridge regression fits a straight line (or plane) while discouraging extreme slopes. PCA finds the directions along which data varies most. Both are linear. Swap their inner products for a kernel and they become kernel ridge regression, which fits smooth curves in one matrix solve, and kernel PCA, which finds curved structure such as “distance from the centre”. Same algorithms, new geometry.
KRR, often under the name Gaussian-process regression, is a go-to model for learning residual dynamics of a robot or drone from a few hundred samples, for calibrating sensors, and for surrogate models of expensive CFD or thermal simulations. Kernel PCA is used for nonlinear dimensionality reduction and anomaly detection on telemetry.
- 1. Kernel ridge regression fits…
- 2. Kernel PCA finds…
- 3. Increasing λ in KRR makes the fit…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Kernel ridge regression
The fitted values are with the hat matrix .
Effective degrees of freedom
where are the eigenvalues of K. Each eigen-direction counts fully (μ much larger than λm) or not at all. So df runs from m (as λ → 0) down to 0.
Cost
Training is an m×m solve, O(m³) time and O(m²) memory. Prediction is O(m) per point.
- 1. KRR coefficients:
- 2. df for K = I (4×4), λ = 0.25, m = 4:
- 3. As λ → 0, df → …
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Leave-one-out for free
For any linear smoother where deleting point i amounts to re-solving with the same H structure (true for KRR), the leave-one-out residual is
so you can tune λ and γ by exact LOO at the cost of one fit.
KRR = Gaussian-process mean
With GP prior and noise , the posterior mean is , which is KRR with . The GP adds a variance, , for uncertainty.
Kernel PCA
Centre in feature space: with . Eigen-decompose . The projection of on component j is , and is the variance along it. A linear kernel recovers ordinary PCA.
- 1. The LOO residual equals…
- 2. KRR equals the GP posterior mean when…
- 3. Kernel PCA needs the Gram matrix to be…
Level 3: Advanced
★★★★☆ Advanced⏱ 35 minGraduate level, with full derivations and proofs.Proof of the LOO formula
Let equal y except . Then also minimizes the full objective on (point i contributes zero loss there, and it’s optimal for the rest). So . Solving for gives the formula. ∎
Why kernel PCA works
Feature-space covariance . Any eigenvector with λ ≠ 0 lies in the span of the , so . Substituting gives (on the range of ). Normalizing means , so , and projections are . ∎
Bias and variance in the spectrum
KRR shrinks the component of y along each eigenvector of K by . Large-μ (smooth) directions are kept and small-μ (wiggly) ones are killed: spectral filtering. Variance shrinks with df, and bias grows as λm passes the eigenvalues where the signal lives.
- 1. KRR shrinks the eigen-component i of y by…
- 2. The kernel-PCA projection of xᵢ on component j is…
- 3. Feature-space PCA eigenvectors lie in…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.KRR and kPCA, measured
Exercise 1 (RBF γ = 2, noise σ = 0.3). The closed-form LOO equals brute-force refitting to 10⁻¹⁵ (0.155965 for both), and KRR equals the GP mean with σ² = λm exactly. Sweeping λ with m = 100, as train / LOO / test MSE:
| λ | train | LOO | test |
|---|---|---|---|
| 10⁻⁶ | 0.074 | 0.104 | 0.025 |
| 10⁻⁴ | 0.075 | 0.096 | 0.014 |
| 10⁻³ | 0.077 | 0.095 | 0.012 |
| 10⁻² | 0.105 | 0.122 | 0.046 |
| 10⁻¹ | 0.409 | 0.445 | 0.403 |
| 1 | 0.745 | 0.758 | 0.799 |
The test error is U-shaped, and LOO, which is about the noise variance 0.09 plus the test error, picks the same λ = 10⁻³.
Exercise 2. Linear-kernel kPCA equals PCA to 4 × 10⁻¹⁵, and its eigenvalues are the component variances. On two rings (radii 0.5 and 1.5), a threshold on the first component separates 66.5% with linear PCA, 64.5% and 61.5% with RBF γ = 0.1 and 0.5, 100% with γ = 1 and 2, then 94.5% and 78.0% with γ = 5 and 20. The kernel must match the structure’s scale.
KRR and kPCA in AI, robotics and aerospace
- GP and KRR dynamics models for model-based control (PILCO), and residual-dynamics learning on quadrotors.
- Surrogate modelling and Bayesian optimization of designs such as airfoils and thermal layouts.
- Kernel PCA for nonlinear feature extraction and novelty detection on spacecraft telemetry.
- Scalable variants: Nyström, random features and inducing-point GPs for onboard use.
References
- C. Saunders, A. Gammerman, V. Vovk (1998). “Ridge regression learning algorithm in dual variables.” ICML.
- B. Schölkopf, A. Smola, K.-R. Müller (1998). “Nonlinear component analysis as a kernel eigenvalue problem.” Neural Computation, 10.
- C. E. Rasmussen, C. K. I. Williams (2006). Gaussian Processes for Machine Learning. MIT Press.
- G. Wahba (1990). Spline Models for Observational Data. SIAM (leave-one-out and GCV).
- M. P. Deisenroth, C. E. Rasmussen (2011). “PILCO: a model-based and data-efficient approach to policy search.” ICML.