Skip to content

Commit 99d4616

Browse files
committed
Added derivation info to docstring
1 parent 4840b88 commit 99d4616

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pymc/gp/cov.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,26 @@ def power_spectral_density(self, omega: TensorLike) -> TensorVariable:
623623
\left(\frac{z}{2}\right)^{\nu}
624624
K_{\nu}(z)
625625
where :math:`z = \sqrt{2\alpha} \sqrt{\sum \ell_i^2 \omega_i^2}` and :math:`\nu = \alpha - D/2`.
626+
627+
Derivation
628+
----------
629+
The Rational Quadratic kernel can be expressed as a scale mixture of Squared Exponential kernels:
630+
631+
.. math::
632+
k_{RQ}(r) = \int_0^\infty k_{SE}(r; \lambda) p(\lambda) d\lambda
633+
634+
where :math:`k_{SE}(r; \lambda) = \exp\left(-\frac{\lambda r^2}{2}\right)` and the mixing distribution
635+
on the precision parameter :math:`\lambda` is :math:`\lambda \sim \text{Gamma}(\alpha, \beta)`
636+
with rate parameter :math:`\beta = \alpha \ell^2`.
637+
638+
By the linearity of the Fourier transform, the PSD of the Rational Quadratic kernel is the expectation
639+
of the PSD of the Squared Exponential kernel with respect to the mixing distribution:
640+
641+
.. math::
642+
S_{RQ}(\omega) = \int_0^\infty S_{SE}(\omega; \lambda) p(\lambda) d\lambda
643+
644+
Substituting the known PSD of the Squared Exponential kernel and evaluating the integral yields
645+
the expression involving the modified Bessel function of the second kind, :math:`K_{\nu}(z)`.
626646
"""
627647
ls = pt.ones(self.n_dims) * self.ls
628648
alpha = self.alpha

0 commit comments

Comments
 (0)