kernels

Contents

kernels#

The primary model-building interface in smolgp is via “kernels”, typically constructed as sums and products of the objects defined in this subpackage. The kernels here are extensions of those in tinygp.kernels.quasisep and are fully compatible with the state space solvers. Key differences from tinygp.kernels.quasisep:

  1. Each kernel exposes noise_effect_matrix() (\(L\)) and process_noise() (\(Q_k\)).

  2. The observation model is a row vector that can be selected per-component via the kernel’s name attribute (used for multi-component decomposition).

  3. The transition matrix is in its conventional form (not transposed as in tinygp.kernels.quasisep).

For modeling time-averaged (integrated) measurements, use the kernels in smolgp.kernels.integrated.

Sums and products of smolgp kernels are themselves smolgp kernels. Their conditioned and predictive distributions can be decomposed per-component via get_component_mean() and get_all_component_means().

For mixed kernels with both integrated and instantaneous components, the IntegratedStateSpaceSolver is used automatically.

Submodules#

Classes#

StateSpaceModel

The base class for an instantaneous linear Gaussian state space model.

Sum

The sum of two StateSpaceModel kernels.

Product

The product of two StateSpaceModel kernels.

Wrapper

A base class for wrapping kernels with some custom implementations

Scale

The product of a scalar and a state space kernel.

Constant

A constant kernel

SHO

The damped, driven stochastic harmonic oscillator kernel

Exp

A state space implementation of tinygp.kernels.quasisep.Exp

Matern32

A state space implementation of tinygp.kernels.quasisep.Matern32

Matern52

A state space implementation of tinygp.kernels.quasisep.Matern52

Cosine

A state space implementation of tinygp.kernels.quasisep.Cosine

ExpSineSquared

The exponential sine squared or "periodic" kernel

IntegratedSHO

The SHO kernel integrated over a finite time range \(\delta\).

IntegratedExp

The Exp (Ornstein–Uhlenbeck / Matérn-1/2) kernel

IntegratedMatern32

The Matern32 kernel integrated over a finite time range \(\delta\).

IntegratedMatern52

The Matern52 kernel integrated over a finite time range \(\delta\).

IntegratedCosine

The Cosine kernel integrated over a finite time range \(\delta\).

Package Contents#

class smolgp.kernels.StateSpaceModel[source]#

Bases: tinygp.kernels.base.Kernel

The base class for an instantaneous linear Gaussian state space model.

name#

Unique identifier used in multi-component models to select individual components from a sum or product kernel.

Type:

str

dimension#

Dimensionality \(d\) of the state space model.

Type:

int

A state space model is defined by the following components:

  1. design_matrix() — The feedback matrix \(F\)

  2. stationary_covariance() — The stationary covariance \(\mathbf{P}_\infty\)

  3. observation_matrix() — The observation matrix \(H\)

  4. noise() — The spectral density \(Q_c\) of the driving white noise

  5. noise_effect_matrix() — The noise effect matrix \(L\)

  6. transition_matrix() — The transition matrix \(A_k\) (optional; default uses jax.scipy.linalg.expm())

  7. process_noise() — The process noise \(Q_k\) (optional; default uses \(\mathbf{P}_\infty - A_k \mathbf{P}_\infty A_k^\top\) or the Van Loan matrix exponential)

As a subclass of tinygp.kernels.Kernel, this class supports addition and multiplication with other kernels via Sum and Product, as well as direct kernel evaluation.

name: str#
coord_to_sortable(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

A helper function used to convert coordinates to sortable 1-D values

By default, this is the identity, but in cases where X is structured (e.g. multivariate inputs), this can be used to appropriately unwrap that structure.

property dimension: int#

The dimension of the state space model, d

abstractmethod design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the process, \(F\)

abstractmethod stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the process, \(\mathbf{P}_\infty\)

observation_model(X: tinygp.helpers.JAXArray, component: str | None = None) tinygp.helpers.JAXArray[source]#

The observation model for the process, \(H\)

abstractmethod observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation matrix for the process, \(H\)

abstractmethod noise() tinygp.helpers.JAXArray[source]#

The spectral density of the white noise process, \(Q_c\)

abstractmethod noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix, \(L\)

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix \(A_k\) between two states at coordinates X1 and X2.

Default behavior uses jax.scipy.linalg.expm(self.design_matrix() * (X2 - X1)), which is appropriate for stationary kernels defined by a linear Gaussian SSM.

Overload this method if you have a more general model or simply wish to define the transition matrix analytically.

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray, use_van_loan=False) tinygp.helpers.JAXArray[source]#

The process noise matrix \(Q_k\)

Default behavior computes \(Q_k = \mathbf{P}_\infty - A_k \mathbf{P}_\infty A_k^T\) (see Eq. 7 in Solin & Särkka (2014)). Pass use_van_loan=True to instead compute \(Q_k\) via the Van Loan (1978) matrix exponential method using \(F\), \(L\), and \(Q_c\).

Overload this method if you have a more general model or wish to define the process noise analytically.

reset_matrix(instid: int = 0) tinygp.helpers.JAXArray[source]#

The reset matrix for an instantaneous state space model is trivially the identity matrix.

__add__(other: tinygp.kernels.base.Kernel | tinygp.helpers.JAXArray) tinygp.kernels.base.Kernel[source]#
__radd__(other: Any) tinygp.kernels.base.Kernel[source]#
__mul__(other: tinygp.kernels.base.Kernel | tinygp.helpers.JAXArray) tinygp.kernels.base.Kernel[source]#
__rmul__(other: Any) tinygp.kernels.base.Kernel[source]#
evaluate(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The kernel evaluated via the state space representation.

See Eq. 4 in Hartikainen & Särkkä (2010).

evaluate_diag(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

For state space kernels, the variance is simple to compute

psd(omega: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The power spectral density (PSD) of the kernel.

See Eq. 8 in Solin & Särkka (2014).

class smolgp.kernels.Sum(kernel1, kernel2)[source]#

Bases: StateSpaceModel

The sum of two StateSpaceModel kernels.

The joint state dimension is \(d = d_1 + d_2\), and all matrices are assembled as block-diagonal combinations of the two component kernels.

kernel1: StateSpaceModel#
kernel2: StateSpaceModel#
name#
property dimension: int#

The dimension of the summed state space model

coord_to_sortable(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

We assume that both kernels use the same coordinates

design_matrix() tinygp.helpers.JAXArray[source]#

\(F = \mathrm{BlockDiag}(F_1,\, F_2)\)

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

\(L = \mathrm{BlockDiag}(L_1,\, L_2)\)

stationary_covariance() tinygp.helpers.JAXArray[source]#

\(\mathbf{P}_\infty = \mathrm{BlockDiag}(\mathbf{P}_{\infty,1},\, \mathbf{P}_{\infty,2})\)

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(A_k = \mathrm{BlockDiag}(A_{k,1},\, A_{k,2})\)

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(Q_k = \mathrm{BlockDiag}(Q_{k,1},\, Q_{k,2})\)

observation_model(X: tinygp.helpers.JAXArray, component=None) tinygp.helpers.JAXArray[source]#

\(H = [H_1 \;\; H_2]\), with optional component masking.

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(H = [H_1 \;\; H_2]\)

reset_matrix(instid: int = 0) tinygp.helpers.JAXArray[source]#

\(\mathrm{RESET} = \mathrm{BlockDiag}(\mathrm{RESET}_1,\, \mathrm{RESET}_2)\)

noise() tinygp.helpers.JAXArray[source]#

\(Q_c = \mathrm{BlockDiag}(Q_{c,1},\, Q_{c,2})\)

class smolgp.kernels.Product(kernel1, kernel2)[source]#

Bases: StateSpaceModel

The product of two StateSpaceModel kernels.

The joint state dimension is \(d = d_1 \cdot d_2\), and all matrices are assembled using Kronecker products of the two component kernels.

kernel1: StateSpaceModel#
kernel2: StateSpaceModel#
name#
property dimension: int#

The dimension of the product state space model

coord_to_sortable(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

We assume that both kernels use the same coordinates

design_matrix() tinygp.helpers.JAXArray[source]#

\(F = F_1 \otimes I + I \otimes F_2\)

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

\(L\) for products is not uniquely defined, only the combination \(L Q_c L^T\) is. A convenient choice then for \(L\) is the identity matrix, which we return here. Then, \(Q_c\) is chosen so that \(L Q_c L^T\) gives the correct process noise.

stationary_covariance() tinygp.helpers.JAXArray[source]#

\(\mathbf{P}_\infty = \mathbf{P}_{\infty,1} \otimes \mathbf{P}_{\infty,2}\)

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(A_k = A_{k,1} \otimes A_{k,2}\)

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(Q_k\) for a product is best determined via the identity \(Q_k = \mathbf{P}_\infty - A_k \mathbf{P}_\infty A_k^T\).

observation_model(X: tinygp.helpers.JAXArray, component=None) tinygp.helpers.JAXArray[source]#

\(H = H_1 \otimes H_2\), with optional component masking.

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

\(H = H_1 \otimes H_2\)

reset_matrix(instid: int = 0) tinygp.helpers.JAXArray[source]#

\(\mathrm{RESET} = \mathrm{RESET}_1 \otimes \mathrm{RESET}_2\)

noise() tinygp.helpers.JAXArray[source]#

\(Q_c\) for products is not uniquely defined.

Returns \(Q_c = L_1 Q_{c,1} L_1^T \otimes \mathbf{P}_{\infty,2} + \mathbf{P}_{\infty,1} \otimes L_2 Q_{c,2} L_2^T\), with \(L = I\), so that \(L Q_c L^T\) yields the correct process noise.

class smolgp.kernels.Wrapper[source]#

Bases: StateSpaceModel

A base class for wrapping kernels with some custom implementations

kernel: StateSpaceModel#
property dimension: int#

The dimension of the state space model, d

coord_to_sortable(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

A helper function used to convert coordinates to sortable 1-D values

By default, this is the identity, but in cases where X is structured (e.g. multivariate inputs), this can be used to appropriately unwrap that structure.

design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the process, \(F\)

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix, \(L\)

noise() tinygp.helpers.JAXArray[source]#

The spectral density of the white noise process, \(Q_c\)

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the process, \(\mathbf{P}_\infty\)

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation matrix for the process, \(H\)

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix \(A_k\) between two states at coordinates X1 and X2.

Default behavior uses jax.scipy.linalg.expm(self.design_matrix() * (X2 - X1)), which is appropriate for stationary kernels defined by a linear Gaussian SSM.

Overload this method if you have a more general model or simply wish to define the transition matrix analytically.

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise matrix \(Q_k\)

Default behavior computes \(Q_k = \mathbf{P}_\infty - A_k \mathbf{P}_\infty A_k^T\) (see Eq. 7 in Solin & Särkka (2014)). Pass use_van_loan=True to instead compute \(Q_k\) via the Van Loan (1978) matrix exponential method using \(F\), \(L\), and \(Q_c\).

Overload this method if you have a more general model or wish to define the process noise analytically.

reset_matrix(instid=0)[source]#

The reset matrix for an instantaneous state space model is trivially the identity matrix.

class smolgp.kernels.Scale[source]#

Bases: Wrapper

The product of a scalar and a state space kernel.

scale: tinygp.helpers.JAXArray | float#
stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the process, \(\mathbf{P}_\infty\)

noise() tinygp.helpers.JAXArray[source]#

The spectral density of the white noise process, \(Q_c\)

class smolgp.kernels.Constant(sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'Constant', **kwargs)[source]#

Bases: StateSpaceModel

A constant kernel

\[k(\mathbf{x}_i,\,\mathbf{x}_j) = \sigma^2\]

where \(\sigma\) is a parameter.

Parameters:

sigma – The parameter \(\sigma\) in the above equation.

sigma: tinygp.helpers.JAXArray | float#
name = 'Constant'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for a Constant process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of a Constant process, Pinf

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for a Constant process

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for a Constant process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for a Constant process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for a Constant process

process_noise(X1, X2, use_van_loan=False)[source]#

The process noise Q_k for a Constant process

class smolgp.kernels.SHO(omega: tinygp.helpers.JAXArray | float, quality: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'SHO', **kwargs)[source]#

Bases: StateSpaceModel

The damped, driven stochastic harmonic oscillator kernel

This form of the kernel was introduced by Foreman-Mackey et al. (2017), and it takes the form:

\[\begin{split}k(\Delta) = \sigma^2\,\exp\left(-\frac{\omega_0\,\Delta}{2\,Q}\right) \left\{\begin{array}{ll} 1 + \omega_0\,\Delta & \mbox{for } Q = 1/2 \\ \cosh(\eta\,\omega_0\,\Delta) + \frac{1}{2\eta Q} \sinh(\eta\,\omega_0\,\Delta) & \mbox{for } Q < 1/2 \\ \frac{1}{2\eta Q}\cos(\eta\,\omega_0\,\Delta) + \sin(\eta\,\omega_0\,\Delta) & \mbox{for } Q > 1/2 \end{array}\right.\end{split}\]

for \(\Delta = |x_i - x_j|\), \(\eta = \sqrt{|1 - 1/(4Q^2)|}\).

Parameters:
  • omega – The parameter \(\omega_0\).

  • quality – The parameter \(Q\).

  • sigma (optional) – The parameter \(\sigma\). Defaults to a value of 1. Specifying the explicit value here provides a slight performance boost compared to independently multiplying the kernel with a prefactor.

omega: tinygp.helpers.JAXArray | float#
quality: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
eta: tinygp.helpers.JAXArray | float#
name = 'SHO'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the SHO process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the SHO process, Pinf

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for the SHO process

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for the SHO process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for the SHO process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the SHO process

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the SHO process

class smolgp.kernels.Exp(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'Exp', **kwargs)[source]#

Bases: StateSpaceModel

A state space implementation of tinygp.kernels.quasisep.Exp

This kernel takes the form:

\[k(\Delta)=\sigma^2\,\exp\left(-\frac{\Delta}{\ell}\right)\]

for \(\Delta = |x_i - x_j|\). Also known as the “Ornstein-Uhlenbeck” kernel, and is also equivalent to a Matérn-1/2 kernel.

Parameters:
  • scale – The parameter \(\ell\).

  • sigma (optional) – The parameter \(\sigma\). Defaults to a value of 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'Exp'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the Exp process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the Exp process, Pinf

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for the Exp process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for the Exp process

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for the Exp process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the Exp process

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the Exp process

class smolgp.kernels.Matern32(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'Matern32', **kwargs)[source]#

Bases: StateSpaceModel

A state space implementation of tinygp.kernels.quasisep.Matern32

This kernel takes the form:

\[k(\Delta)=\sigma^2\,\left(1+f\,\Delta\right)\,\exp(-f\,\Delta)\]

for \(\Delta = |x_i - x_j|\) and \(f = \sqrt{3} / \ell\).

Parameters:
  • scale – The parameter \(\ell\).

  • sigma (optional) – The parameter \(\sigma\). Defaults to a value of 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'Matern32'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the Matern-3/2 process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the Matern-3/2 process, Pinf

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for the Matern-3/2 process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for the Matern-3/2 process

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for the Matern-3/2 process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the Matern-3/2 process

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the Matern-3/2 process

class smolgp.kernels.Matern52(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'Matern52', **kwargs)[source]#

Bases: StateSpaceModel

A state space implementation of tinygp.kernels.quasisep.Matern52

This kernel takes the form:

\[k(\Delta)=\sigma^2\,\left(1+f\,\Delta + \frac{f^2\,\Delta^2}{3}\right) \,\exp(-f\,\Delta)\]

for \(\Delta = |x_i - x_j|\) and \(f = \sqrt{5} / \ell\).

Parameters:
  • scale – The parameter \(\ell\).

  • sigma (optional) – The parameter \(\sigma\). Defaults to a value of 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'Matern52'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the Matern-5/2 process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the Matern-5/2 process, Pinf

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for the Matern-5/2 process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for the Matern-5/2 process

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for the Matern-5/2 process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the Matern-5/2 process

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the Matern-5/2 process

class smolgp.kernels.Cosine(scale, sigma=jnp.ones(()), name='Cosine', **kwargs)[source]#

Bases: StateSpaceModel

A state space implementation of tinygp.kernels.quasisep.Cosine

This kernel takes the form:

\[k(\Delta)=\sigma^2\,\cos(-2\,\pi\,\Delta/\ell)\]

for \(\Delta = |x_i - x_j|\).

Parameters:
  • scale – The parameter \(\ell\).

  • sigma (optional) – The parameter \(\sigma\). Defaults to a value of 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
omega: tinygp.helpers.JAXArray | float#
name = 'Cosine'#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the Cosine process, F

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the Cosine process, Pinf

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation model H for the Cosine process

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix L for the Cosine process

noise() tinygp.helpers.JAXArray[source]#

The scalar Qc for the Cosine process

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the Cosine process

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the Cosine process

class smolgp.kernels.ExpSineSquared(period: tinygp.helpers.JAXArray | float, gamma: tinygp.helpers.JAXArray | float = jnp.ones(()), sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), name: str = 'ExpSineSquared', order: int | None = None, **kwargs)[source]#

Bases: Wrapper

The exponential sine squared or “periodic” kernel

\[k(\mathbf{x}_i,\,\mathbf{x}_j) = \sigma^2 \exp(-\Gamma\,\sin^2 \pi r)\]

where, by default,

\[r = ||(\mathbf{x}_i - \mathbf{x}_j) / P||_1\]

In the state space representation, this kernel is approximated using a finite number of basis functions. The method was introduced by Solin & Särkkä (2014). See their Figure 2 for the number of basis functions required to reach desired accuracy. Default behavior will automatically select the number of basis functions based on the length scale \(\ell\).

Parameters:
  • period – The parameter \(P\).

  • gamma – The parameter \(\Gamma\).

  • sigma – The parameter \(\sigma\). Defaults to a value of 1.

gamma: tinygp.helpers.JAXArray | float | None = None#
period: tinygp.helpers.JAXArray | float#
scale: tinygp.helpers.JAXArray | float#
omega: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
order: int | None#
kernel: StateSpaceModel#
name = 'ExpSineSquared'#
error_bound()[source]#

An upper bound on the error in the covariance from the Taylor series approximation.

See Sec 3.4 of Solin & Särkkä (2014).

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the process, \(\mathbf{P}_\infty\)

class PeriodicTerm(order, omega, scale, **kwargs)[source]#

Bases: StateSpaceModel

A single term in the state space representation of the exponential sine squared or “periodic” kernel

See Solin & Särkkä (2014) for details.

order: int#
omega: tinygp.helpers.JAXArray | float#
scale: tinygp.helpers.JAXArray | float#
name#
design_matrix() tinygp.helpers.JAXArray[source]#

The design (also called the feedback) matrix for the PeriodicTerm, \(F\)

stationary_covariance() tinygp.helpers.JAXArray[source]#

The stationary covariance of the PeriodicTerm process, \(\mathbf{P}_\infty\)

observation_matrix(X: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The observation matrix for the PeriodicTerm, \(H\)

noise() tinygp.helpers.JAXArray[source]#

The spectral density of the white noise for the PeriodicTerm, \(Q_c\)

noise_effect_matrix() tinygp.helpers.JAXArray[source]#

The noise effect matrix \(L\) for the PeriodicTerm

Ij(j, x, terms=50) tinygp.helpers.JAXArray[source]#

The modified Bessel function of the first kind, order j, at x. Approximated via a truncated Taylor series expansion.

transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The transition matrix A_k for the PeriodicTerm

process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The process noise Q_k for the PeriodicTerm

class smolgp.kernels.IntegratedSHO(omega: tinygp.helpers.JAXArray | float, quality: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), num_insts: int = 1, name: str = 'IntegratedSHO', **kwargs)[source]#

Bases: IntegratedStateSpaceModel

The SHO kernel integrated over a finite time range \(\delta\).

Models the time-averaged version of the damped, driven stochastic harmonic oscillator kernel (see SHO). Each measurement is the average of the latent GP over an exposure window of length \(\delta\) centred on the observation time.

Parameters:
  • omega – The natural frequency \(\omega_0\).

  • quality – The quality factor \(Q\).

  • sigma (optional) – The amplitude \(\sigma\). Defaults to 1. Specifying it here provides a slight performance boost over multiplying the kernel by a scalar after construction.

  • num_insts (optional) – Number of distinct instrument datasets. Defaults to 1.

omega: tinygp.helpers.JAXArray | float#
quality: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
eta: tinygp.helpers.JAXArray | float#
num_insts = 1#
name = 'IntegratedSHO'#
base_model#
integrated_transition_matrix(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The integrated transition matrix Phibar for the SHO process

integrated_process_noise(X1: tinygp.helpers.JAXArray, X2: tinygp.helpers.JAXArray) tinygp.helpers.JAXArray[source]#

The integrated process noise submatrices for the SHO process

class smolgp.kernels.IntegratedExp(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), num_insts: int = 1, name: str = 'IntegratedExp', **kwargs)[source]#

Bases: IntegratedStateSpaceModel

The Exp (Ornstein–Uhlenbeck / Matérn-1/2) kernel integrated over a finite time range \(\delta\).

Parameters:
  • scale – The length scale \(\ell\).

  • sigma (optional) – The amplitude \(\sigma\). Defaults to 1.

  • num_insts (optional) – Number of distinct instrument datasets. Defaults to 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'IntegratedExp'#
num_insts = 1#
base_model#
class smolgp.kernels.IntegratedMatern32(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), num_insts: int = 1, name: str = 'IntegratedMatern32', **kwargs)[source]#

Bases: IntegratedStateSpaceModel

The Matern32 kernel integrated over a finite time range \(\delta\).

Parameters:
  • scale – The length scale \(\ell\).

  • sigma (optional) – The amplitude \(\sigma\). Defaults to 1.

  • num_insts (optional) – Number of distinct instrument datasets. Defaults to 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'IntegratedMatern32'#
num_insts = 1#
base_model#
class smolgp.kernels.IntegratedMatern52(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), num_insts: int = 1, name: str = 'IntegratedMatern52', **kwargs)[source]#

Bases: IntegratedStateSpaceModel

The Matern52 kernel integrated over a finite time range \(\delta\).

Parameters:
  • scale – The length scale \(\ell\).

  • sigma (optional) – The amplitude \(\sigma\). Defaults to 1.

  • num_insts (optional) – Number of distinct instrument datasets. Defaults to 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
lam: tinygp.helpers.JAXArray | float#
name = 'IntegratedMatern52'#
num_insts = 1#
base_model#
class smolgp.kernels.IntegratedCosine(scale: tinygp.helpers.JAXArray | float, sigma: tinygp.helpers.JAXArray | float = jnp.ones(()), num_insts: int = 1, name: str = 'IntegratedCosine', **kwargs)[source]#

Bases: IntegratedStateSpaceModel

The Cosine kernel integrated over a finite time range \(\delta\).

Parameters:
  • scale – The period \(\ell\).

  • sigma (optional) – The amplitude \(\sigma\). Defaults to 1.

  • num_insts (optional) – Number of distinct instrument datasets. Defaults to 1.

scale: tinygp.helpers.JAXArray | float#
sigma: tinygp.helpers.JAXArray | float#
omega: tinygp.helpers.JAXArray | float#
name = 'IntegratedCosine'#
num_insts = 1#
base_model#