# Gaussian Processes as stochastic differential equations

Imposing time on things

September 18, 2019 — November 25, 2021

🏗️🏗️🏗️ Under heavy construction 🏗️🏗️🏗️

Classic flavours together, Gaussian processes and state filters/ stochastic differential equations and random fields as stochastic differential equations.

Not covered, another concept which includes the same keywords but is distinct: using Gaussian processes to define state process dynamics or observation distribution.

## 1 GP regression via state filtering

I am interested in the trick which makes certain Gaussian process regression problems soluble by making them local, i.e. Markov, with respect to some assumed hidden state, in the same way Kalman filtering does Wiener filtering. This means you get to solve a GP as an SDE using a state filter.

The GP-filtering trick is explained in intro articles , based on various antecedents , possible also . Aside: O’Hagan (1978) is an incredible paper that invented several research areas at once (GP regression, surrogate models for experiment design as well as this) and AFAICT no one noticed at the time. Also Whittle did some foundational work, but I cannot find the original paper to read it.

The idea is that if your GP covariance kernel is (or can be well approximated by) a rational function then it is possible to factorise it into a tractable state space model, using a duality between random fields and stochastic differential equations. That sounds simple enough conceptually; I wonder about the practice. Of course, when you want some complications, such as non-stationary kernels or hierarchical models, this state space inference trick gets more complicated, and posterior distributions are no longer so simple. But possibly it can still go. (This is a research interest of mine.)

William J. Wilkinson et al. (2020) introduces a computational toolkit and many worked examples of inference algorithms. Cox, van de Laar, and de Vries (2019) looks like it might be solving a similar problem but I do not yet understand their framing.

This complements, perhaps, the trick of fast Gaussian process calculations on lattices.

Nickisch, Solin, and Grigorevskiy (2018) tries to introduce a vocabulary for inference based on this insight, by discussing it in terms of computational primitives

In time-series data, with D = 1, the data sets tend to become long (or unbounded) when observations accumulate over time. For these time-series models, leveraging sequential state space methods from signal processing makes it possible to solve GP inference problems in linear time complexity O(n) if the underlying GP has Markovian structure . This reformulation is exact for Markovian covariance functions (see, e.g., Solin (2016)) such as the exponential, half-integer Matérn, noise, constant, linear, polynomial, Wiener, etc. (and their sums and products).…

While existing literature has focused on the connection between GP regression and state space methods, the computational primitives allowing for inference using general likelihoods in combination with the Laplace approximation (LA), variational Bayes (VB), and assumed density filtering (ADF, a.k.a. single-sweep expectation propagation, EP) schemes has been largely overlooked.… We present a unifying framework for solving computational primitives for non-Gaussian inference schemes in the state space setting, thus directly enabling inference to be done through LA, VB, KL, and ADF/EP.

The following computational primitives allow to cast the covariance approximation in more generic terms: 1. Linear system with “regularized” covariance: $\text { solve }_{\mathbf{K}}(\mathbf{W}, \mathbf{r}):=\left(\mathbf{K}+\mathbf{W}^{-1}\right)^{-1} \mathbf{r}$ 2. Matrix-vector multiplications: $$\operatorname{mvm}_{\mathbf{K}}(\mathbf{r}):=\mathbf{K r}$$. For learning we also need $$\frac{\operatorname{mvm}_{K}(\mathbf{r})}{\partial \theta}$$. 3. Log-determinants: $$\operatorname{ld}_{\mathbf{K}}(\mathbf{W}):=\log |\mathbf{B}|$$ with symmetric and well-conditioned $$\mathbf{B}=\mathbf{I}+\mathbf{W}^{\frac{1}{2}} \mathbf{K} \mathbf{W}^{\frac{1}{2}}$$. For learning, we need derivatives: $$\frac{\partial \operatorname{ld} \mathbf{K}(\mathbf{W})}{\partial \boldsymbol{\theta}}, \frac{\partial \operatorname{ld} \mathbf{K}(\mathbf{W})}{\partial \mathbf{W}}$$ 4. Predictions need latent mean $$\mathbb{E}\left[f_{*}\right]$$ and variance $$\mathbb{V}\left[f_{*}\right]$$.

Using these primitives, GP regression can be compactly written as $$\mathbf{W}=\mathbf{I} / \sigma_{n}^{2}, \boldsymbol{\alpha}=\operatorname{solve}_{\mathbf{K}}(\mathbf{W}, \mathbf{y}-\mathbf{m}),$$ and $$\log Z_{\mathrm{GPR}}=$$ $-\frac{1}{2}\left[\boldsymbol{\alpha}^{\top} \mathrm{mvm}_{\mathrm{K}}(\boldsymbol{\alpha})+\mathrm{ld}_{\mathrm{K}}(\mathbf{W})+n \log \left(2 \pi \sigma_{n}^{2}\right)\right]$ Approximate inference $$(\mathrm{LA}, \mathrm{VB}, \mathrm{KL}, \mathrm{ADF} / \mathrm{EP})-$$ in case of non-Gaussian likelihoods - requires these primitives as necessary building blocks. Depending on the covariance approximation method e.g. exact, sparse, grid-based, or state space, the four primitives differ in their implementation and computational complexity.

Recent works I should also inspect include .

Ambikasaran et al. (2015) seems to be related but not quite the same — it operates time-wise over inputs but then constructs the GP posterior using rank-1 updates.

## 3 Latent force models

I am going to argue that some latent force models fit in this classification, if I ever get time to define them .

## 4 Miscellaneous notes towards implementation

• Julia’s DynamicPolynomials.jl implements the MultivariatePolynomials, appears to be differentiable and handles rational polynomials.
• TemporalGPs.jl, introduced by Will Tebbutt, is a julia implementation of this.
• The abstract ForneyLab.jl system might relate to this, behind its abstruse framing. Cox, van de Laar, and de Vries (2019)
• https://pyro.ai/examples/dkl.html
• https://pyro.ai/examples/gp.html
• https://pyro.ai/examples/ekf.html
• https://julialang.org/blog/2019/01/fluxdiffeq
• https://github.com/FluxML/model-zoo/tree/master/contrib/diffeq
• http://pyro.ai/examples/gplvm.html
• http://pyro.ai/examples/dmm.html
• http://docs.pyro.ai/en/stable/contrib.gp.html
• https://nbviewer.jupyter.org/github/SheffieldML/notebook/blob/master/GPy/index.ipynb
• https://blog.dominodatalab.com/fitting-gaussian-process-models-python/

## 5 References

Álvarez, Mauricio, Luengo, and Lawrence. 2009. In Artificial Intelligence and Statistics.
Álvarez, Mauricio A., Luengo, and Lawrence. 2013. IEEE Transactions on Pattern Analysis and Machine Intelligence.
Ambikasaran, Foreman-Mackey, Greengard, et al. 2015. arXiv:1403.6015 [Astro-Ph, Stat].
Bakka, Rue, Fuglstad, et al. 2018. WIREs Computational Statistics.
Bolin, Simas, and Wallin. 2022.
Chang, Wilkinson, Khan, et al. 2020. “Fast Variational Learning in State-Space Gaussian Process Models.” In MLSP.
Cotter, Roberts, Stuart, et al. 2013. Statistical Science.
Cox, van de Laar, and de Vries. 2019. International Journal of Approximate Reasoning.
Cressie, Shi, and Kang. 2010. Journal of Computational and Graphical Statistics.
Cressie, and Wikle. 2014. In Wiley StatsRef: Statistics Reference Online.
Csató, and Opper. 2002. Neural Computation.
Cunningham, Shenoy, and Sahani. 2008. In Proceedings of the 25th International Conference on Machine Learning. ICML ’08.
Curtain. 1975. SIAM Journal on Control.
Dowling, Sokół, and Park. 2021.
Durrande, Adam, Bordeaux, et al. 2019. In Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics.
Eleftheriadis, Nicholson, Deisenroth, et al. 2017. In Advances in Neural Information Processing Systems 30.
Gilboa, Saatçi, and Cunningham. 2015. IEEE Transactions on Pattern Analysis and Machine Intelligence.
Gorad, Zhao, and Särkkä. 2020. “Parameter Estimation in Non-Linear State-Space Models by Automatic Differentiation of Non-Linear Kalman Filters.” In.
Grigorievskiy, and Karhunen. 2016. In 2016 International Joint Conference on Neural Networks (IJCNN).
Grigorievskiy, Lawrence, and Särkkä. 2017. In arXiv:1610.08035 [Stat].
Hartikainen, J., and Särkkä. 2010. In 2010 IEEE International Workshop on Machine Learning for Signal Processing.
Hartikainen, Jouni, and Särkkä. 2011. “Sequential Inference for Latent Force Models.” In Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence. UAI’11.
Hartikainen, Jouni, Seppänen, and Särkkä. 2012. In Proceedings of the 29th International Coference on International Conference on Machine Learning. ICML’12.
Heaps. 2020. arXiv:2004.09455 [Stat].
Hensman, Durrande, and Solin. 2018. Journal of Machine Learning Research.
Hildeman, Bolin, and Rychlik. 2019. arXiv:1906.00286 [Stat].
Huber. 2014. Pattern Recognition Letters.
Hu, and Steinsland. 2016. WIREs Computational Statistics.
Karvonen, and Särkkä. 2016. In 2016 IEEE 26th International Workshop on Machine Learning for Signal Processing (MLSP).
Kavčić, and Moura. 2000. IEEE Transactions on Information Theory.
Kuzin, Yang, Isupova, et al. 2018. 2018 21st International Conference on Information Fusion (FUSION).
Lemercier, Salvi, Cass, et al. 2021. In Proceedings of the 38th International Conference on Machine Learning.
Lindgren, Bolin, and Rue. 2021. arXiv:2111.01084 [Stat].
Lindgren, and Rue. 2015. Journal of Statistical Software.
Lindgren, Rue, and Lindström. 2011. Journal of the Royal Statistical Society: Series B (Statistical Methodology).
Liu, and Röckner. 2015. Stochastic Partial Differential Equations: An Introduction.
Loeliger, Dauwels, Hu, et al. 2007. Proceedings of the IEEE.
Lord, Powell, and Shardlow. 2014. An Introduction to Computational Stochastic PDEs. Cambridge Texts in Applied Mathematics.
Mbalawata, Särkkä, and Haario. 2013. Computational Statistics.
Nickisch, Solin, and Grigorevskiy. 2018. In International Conference on Machine Learning.
O’Hagan. 1978. Journal of the Royal Statistical Society: Series B (Methodological).
Opitz, Huser, Bakka, et al. 2018. Extremes.
Peluchetti, and Favaro. 2020. In International Conference on Artificial Intelligence and Statistics.
Rackauckas, Ma, Martensen, et al. 2020. arXiv.org.
Reece, Steven, Ghosh, Rogers, et al. 2014. The Journal of Machine Learning Research.
Reece, S., and Roberts. 2010. In 2010 13th International Conference on Information Fusion.
Remes, Heinonen, and Kaski. 2017. In Advances in Neural Information Processing Systems 30.
———. 2018. arXiv:1811.10978 [Cs, Stat].
Rue, Riebler, Sørbye, et al. 2016. arXiv:1604.00860 [Stat].
Saatçi. 2012.
Särkkä. 2011. In Artificial Neural Networks and Machine Learning – ICANN 2011. Lecture Notes in Computer Science.
———. 2013. Bayesian Filtering and Smoothing. Institute of Mathematical Statistics Textbooks 3.
Särkkä, Álvarez, and Lawrence. 2019. IEEE Transactions on Automatic Control.
Särkkä, and Hartikainen. 2012. In Artificial Intelligence and Statistics.
Särkkä, and Solin. 2019. Applied Stochastic Differential Equations. Institute of Mathematical Statistics Textbooks 10.
Särkkä, Solin, and Hartikainen. 2013. IEEE Signal Processing Magazine.
Sidén. 2020. Scalable Bayesian Spatial Analysis with Gaussian Markov Random Fields. Linköping Studies in Statistics.
Sigrist, Künsch, and Stahel. 2015a. Application/pdf. Journal of Statistical Software.
———. 2015b. Journal of the Royal Statistical Society: Series B (Statistical Methodology).
Singer. 2011. AStA Advances in Statistical Analysis.
Solin, and Särkkä. 2013. Physical Review E.
———. 2014. In Artificial Intelligence and Statistics.
———. 2020. Statistics and Computing.
Tobar. 2019. Advances in Neural Information Processing Systems.
Tzinis, Wang, and Smaragdis. 2020. “Sudo Rm -Rf: Efficient Networks for Universal Audio Source Separation.” In.
Valenzuela, and Tobar. 2019. In ICASSP 2019 - 2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).
Vandenberg-Rodes, and Shahbaba. 2015. arXiv:1502.03466 [Stat].
Wilkinson, William J., Andersen, Reiss, et al. 2019a. arXiv:1901.11436 [Cs, Eess, Stat].
Wilkinson, William J., Andersen, Reiss, et al. 2019b. In ICASSP 2019 - 2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).
Wilkinson, William J, Chang, Andersen, et al. 2019c. “Global Approximate Inference via Local Linearisation for Temporal Gaussian Processes.”
Wilkinson, William J., Chang, Andersen, et al. 2020. In ICML.
Wilkinson, William J., Särkkä, and Solin. 2021.
Wilson, Borovitskiy, Terenin, et al. 2020. In Proceedings of the 37th International Conference on Machine Learning.
Wilson, Borovitskiy, Terenin, et al. 2021. Journal of Machine Learning Research.
Zammit-Mangion, and Wikle. 2020. Spatial Statistics.