ramsey.experimental#

Experimental modules such as Gaussian processes or Bayesian neural networks.

Warning

Experimental code is not native Ramsey code and subject to change, and might even get deleted in the future. Better don’t build critical code bases around the ramsey.experimental submodule.

Covariance functions#

ExponentiatedQuadratic([active_dims, ...])

Exponentiated quadratic covariance function.

Linear([active_dims, sigma_b_init, ...])

Linear covariance function.

Periodic(period[, active_dims, rho_init, ...])

Periodic covariance function.

exponentiated_quadratic(x1, x2, sigma, rho)

Exponentiated-quadratic convariance function.

linear(x1, x2, sigma_b, sigma_v, offset)

Linear convariance function.

periodic(x1, x2, period, sigma, rho)

Periodic convariance function.

ExponentiatedQuadratic#

class ramsey.experimental.ExponentiatedQuadratic(active_dims=None, *, rho_init=<function constant.<locals>.init>, sigma_init=<function constant.<locals>.init>, param_dtype=<class 'jax.numpy.float32'>, rngs)[source]#

Exponentiated quadratic covariance function.

Parameters:
  • active_dims – either None or a list of integers. Specified the dimensions of the data on which the kernel operates on

  • rho_init – Optional[Initializer] an initializer object from Haiku or None

  • sigma_init – Optional[Initializer] an initializer object from Haiku or None

  • param_dtype – parameter type

  • rngs – a random seed generator

__call__(x1, x2=None)[source]#

Compute the Gram matrix induced by the covariance function.

Parameters:
  • x1 – (n x p)-dimensional set of data points

  • x2 – (m x p)-dimensional set of data points

Returns:#

: jax.Array

returns (n x m)-dimensional set of data points

ramsey.experimental.exponentiated_quadratic(x1, x2, sigma, rho)[source]#

Exponentiated-quadratic convariance function.

Parameters:
  • x1 – (n x p)-dimensional set of data points

  • x2 – (m x p)-dimensional set of data points

  • sigma – the standard deviation of the kernel function

  • rho – the length-scale of the kernel function. Can be a float or a \(p\)-dimensional vector if ARD-behaviour is desired

Returns:

returns a (n x m)-dimensional kernel matrix

Linear#

class ramsey.experimental.Linear(active_dims=None, *, sigma_b_init=<function uniform.<locals>.init>, sigma_v_init=<function uniform.<locals>.init>, offset_init=<function zeros>, param_dtype=<class 'jax.numpy.float32'>, rngs)[source]#

Linear covariance function.

Parameters:
  • active_dims – the indexes of the dimensions the kernel acts upon

  • sigma_b_init – an initializer object from Flax or None

  • sigma_v_init – an initializer object from Flax or None

  • offset_init – an initializer object from Flax or None

  • rngs – a random seed generator

__call__(x1, x2=None)[source]#

Call the covariance function.

ramsey.experimental.linear(x1, x2, sigma_b, sigma_v, offset)[source]#

Linear convariance function.

Parameters:
  • x1 – \(n x p\)-dimensional set of data points

  • x2 – \(m x p\)-dimensional set of data points

  • sigma_b – the standard deviation of the kernel function

  • sigma_v – the standard deviation of the kernel function

  • offset – float

Returns:

returns a \(n x m\)-dimensional Gram matrix

Periodic#

class ramsey.experimental.Periodic(period, active_dims=None, *, rho_init=<function constant.<locals>.init>, sigma_init=<function constant.<locals>.init>, param_dtype=<class 'jax.numpy.float32'>, rngs)[source]#

Periodic covariance function.

Parameters:
  • period – the period of the periodic kernel

  • active_dims – either None or a list of integers. Specified the dimensions of the data on which the kernel operates on

  • rho_init – an initializer object

  • sigma_init – an initializer object from Haiku or None

  • param_dtype – parameter type

  • rngs – a random seed generator

__call__(x1, x2=None)[source]#

Compute the Gram matrix induced by the covariance function.

Parameters:
  • x1 – (n x p)-dimensional set of data points

  • x2 – (m x p)-dimensional set of data points

Returns:#

: jax.Array

returns (n x m)-dimensional set of data points

ramsey.experimental.periodic(x1, x2, period, sigma, rho)[source]#

Periodic convariance function.

Parameters:
  • x1 – (n x p)-dimensional set of data points

  • x2 – (m x p)-dimensional set of data points

  • period – the period

  • sigma – the standard deviation of the kernel function

  • rho – the length-scale of the kernel function. Can be a float or a \(p\)-dimensional vector if ARD-behaviour is desired

Returns:

returns a (n x m)-dimensional Gram matrix