Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Sparse Variational GP with Inducing Points

Sparse GPs approximate the full kernel with M≪NM \ll N inducing points:

K≈KNMKMM−1KMNK \approx K_{NM} K_{MM}^{-1} K_{MN}

The resulting covariance is σ2I+UU⊤\sigma^2 I + U U^\top — a LowRankUpdate in gaussx. We optimize the ELBO with respect to inducing point locations and kernel hyperparameters via jax.grad.

Background

Sparse GP methods address the O(N3)O(N^3) cost of exact GP inference by introducing M≪NM \ll N inducing points Z={zm}m=1MZ = \{z_m\}_{m=1}^M. The key idea is to approximate the full GP posterior via a variational distribution that conditions on the inducing variables u=f(Z)u = f(Z). The Nystrom approximation gives:

Kff≈Qff=KfMKMM−1KMfK_{ff} \approx Q_{ff} = K_{fM} K_{MM}^{-1} K_{Mf}

The variational free energy (VFE) framework (Titsias, 2009) optimizes a lower bound on the log-marginal likelihood:

LVFE=log⁡N(y∣0,Qff+σ2I)−12σ2tr⁡(Kff−Qff)\mathcal{L}_{\text{VFE}} = \log \mathcal{N}(y \mid 0, Q_{ff} + \sigma^2 I) - \frac{1}{2\sigma^2}\operatorname{tr}(K_{ff} - Q_{ff})

The trace correction penalizes the approximation error, and the bound is tight when the inducing points explain all the data.

Generate data

Build Nystrom approximation

The Nystrom factor U=KNMLMM−⊤U = K_{NM} L_{MM}^{-\top} gives QNN=UU⊤Q_{NN} = UU^\top, so the noisy covariance σ2I+UU⊤\sigma^2 I + UU^\top is a rank-MM update of a diagonal -- exactly a LowRankUpdate. This is why gaussx can apply the Woodbury identity for O(NM2+M3)O(NM^2 + M^3) solve and the matrix determinant lemma for O(NM2+M3)O(NM^2 + M^3) logdet.

Data: 300, Inducing: 12
Operator rank: 12

ELBO (variational lower bound)

L=log⁡N(y∣0,σ2I+UU⊤)−12σ2tr(KNN−QNN)\mathcal{L} = \log \mathcal{N}(y \mid 0, \sigma^2 I + U U^\top) - \frac{1}{2\sigma^2} \mathrm{tr}(K_{NN} - Q_{NN})

The first term uses gaussx solve + logdet. The trace correction penalizes information lost by the approximation.

Initial ELBO: -165.14

Optimize hyperparameters

Optimized: ls=1.020, var=1.504, noise=0.0922
Final ELBO: -96.68

Predict

Visualize

<Figure size 1000x400 with 1 Axes>

Summary

Componentgaussx role
low_rank_plus_diagBuild Nystrom covariance
gaussx.solveWoodbury solve for weights
gaussx.logdetMatrix determinant lemma for ELBO
jax.gradDifferentiate through everything

References

  • Quinonero-Candela, J. & Rasmussen, C. E. (2005). A unifying view of sparse approximate Gaussian process regression. JMLR, 6, 1939--1959.
  • Titsias, M. (2009). Variational learning of inducing variables in sparse Gaussian processes. Proc. AISTATS.
  • Hensman, J., Fusi, N., & Lawrence, N. D. (2013). Gaussian processes for big data. Proc. UAI.