You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/contrib.rst
+202Lines changed: 202 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,3 +97,205 @@ Stochastic Support
97
97
:undoc-members:
98
98
:show-inheritance:
99
99
:member-order: bysource
100
+
101
+
102
+
Hilbert Space Gaussian Processes Approximation
103
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
+
105
+
This module contains helper functions for use in the Hilbert Space Gaussian Process (HSGP) approximation method
106
+
described in [1] and [2].
107
+
108
+
.. warning::
109
+
This module is experimental. Currently, it only supports Gaussian processes with one-dimensional inputs.
110
+
111
+
112
+
**Why do we need an approximation?**
113
+
114
+
Gaussian processes do not scale well with the number of data points. Recall we had to invert the kernel matrix!
115
+
The computational complexity of the Gaussian process model is :math:`\mathcal{O}(n^3)`, where :math:`n` is the number of data
116
+
points. The HSGP approximation method is a way to reduce the computational complexity of the Gaussian process model
117
+
to :math:`\mathcal{O}(mn + m)`, where :math:`m` is the number of basis functions used in the approximation.
118
+
119
+
**Approximation Strategy Steps:**
120
+
121
+
We strongly recommend reading [1] and [2] for a detailed explanation of the approximation method. In [3] you can find
122
+
a practical approach using NumPyro and PyMC.
123
+
124
+
Here we provide the main steps and ingredients of the approximation method:
125
+
126
+
1. Each stationary kernel :math:`k` has an associated spectral density :math:`S(\omega)`. There are closed formulas for the most common kernels. These formulas depend on the hyperparameters of the kernel (e.g. amplitudes and length scales).
127
+
2. We can approximate the spectral density :math:`S(\omega)` as a polynomial series in :math:`||\omega||`. We call :math:`\omega` the frequency.
128
+
3. We can interpret these polynomial terms as "powers" of the Laplacian operator. The key observation is that the Fourier transform of the Laplacian operator is :math:`||\omega||^2`.
129
+
4. Next, we impose Dirichlet boundary conditions on the Laplacian operator which makes it self-adjoint and with discrete spectrum.
130
+
5. We identify the expansion in (2) with the sum of powers of the Laplacian operator in the eigenbasis of (4).
131
+
132
+
For the one dimensional case the approximation formula, in the non-centered parameterization, is:
133
+
134
+
.. math::
135
+
136
+
f(x) \approx\sum_{j = 1}^{m}
137
+
\overbrace{\color{red}{\left(S(\sqrt{\lambda_j})\right)^{1/2}}}^{\text{all hyperparameters are here!}}
138
+
\times
139
+
\underbrace{\color{blue}{\phi_{j}(x)}}_{\text{easy to compute!}}
>>> mcmc.run(rng_subkey, x, ell, m, non_centered, y_obs)
207
+
208
+
>>> mcmc.print_summary()
209
+
210
+
mean std median 5.0%95.0% n_eff r_hat
211
+
alpha 1.240.341.180.721.741804.011.00
212
+
beta[0] -0.100.66-0.10-1.240.921819.911.00
213
+
beta[1] 0.000.71-0.01-1.091.261872.821.00
214
+
beta[2] -0.050.69-0.03-1.091.162105.881.00
215
+
beta[3] 0.250.740.26-0.981.422281.301.00
216
+
beta[4] -0.170.69-0.17-1.211.002551.391.00
217
+
beta[5] 0.090.750.10-1.131.303232.131.00
218
+
beta[6] -0.490.75-0.49-1.650.823042.311.00
219
+
beta[7] 0.420.750.44-0.781.652885.421.00
220
+
beta[8] 0.690.710.71-0.481.822811.681.00
221
+
beta[9] -1.430.75-1.40-2.63-0.212858.681.00
222
+
beta[10] 0.330.710.33-0.771.512198.651.00
223
+
beta[11] 1.090.731.11-0.232.182765.991.00
224
+
beta[12] -0.910.72-0.91-2.060.312586.531.00
225
+
beta[13] 0.050.700.04-1.161.122569.591.00
226
+
beta[14] -0.440.71-0.44-1.580.732626.091.00
227
+
beta[15] 0.690.730.70-0.451.882626.321.00
228
+
beta[16] 0.980.740.98-0.152.282282.861.00
229
+
beta[17] -2.540.77-2.52-3.82-1.293347.561.00
230
+
beta[18] 1.350.661.350.302.462638.171.00
231
+
beta[19] 1.100.541.090.252.012428.371.00
232
+
length 0.070.010.070.060.092321.671.00
233
+
noise 0.330.030.330.290.382472.831.00
234
+
235
+
Number of divergences: 0
236
+
237
+
238
+
.. note::
239
+
Additional examples with code can be found in [3], [4] and [5].
240
+
241
+
**References:**
242
+
243
+
1. Solin, A., Särkkä, S. Hilbert space methods for reduced-rank Gaussian process regression.
244
+
Stat Comput 30, 419-446 (2020).
245
+
246
+
2. Riutort-Mayol, G., Bürkner, PC., Andersen, M.R. et al. Practical Hilbert space
247
+
approximate Bayesian Gaussian processes for probabilistic programming. Stat Comput 33, 17 (2023).
248
+
249
+
3. `Orduz, J., A Conceptual and Practical Introduction to Hilbert Space GPs Approximation Methods <https://juanitorduz.github.io/hsgp_intro>`_.
250
+
251
+
4. `Example: Hilbert space approximation for Gaussian processes <https://num.pyro.ai/en/stable/examples/hsgp.html>`_.
252
+
253
+
5. `Gelman, Vehtari, Simpson, et al., Bayesian workflow book - Birthdays <https://avehtari.github.io/casestudies/Birthdays/birthdays.html>`_.
254
+
255
+
.. note::
256
+
The code of this module is based on the code of the example
257
+
`Example: Hilbert space approximation for Gaussian processes <https://num.pyro.ai/en/stable/examples/hsgp.html>`_ by `Omar Sosa Rodríguez <https://github.com/omarfsosa>`_.
0 commit comments