ramsey.data#

Functionality for loading and sampling data sets.

m4_data([interval, drop_na])

Load a data set from the M4 competition.

sample_from_gaussian_process(rng_key[, ...])

Sample from a Gaussian process.

sample_from_sine_function(rng_key[, ...])

Sample from a noisy sine function.

M4 competition data#

ramsey.data.m4_data(interval='hourly', drop_na=True)[source]#

Load a data set from the M4 competition.

Parameters:
  • interval – either of “hourly”, “daily”, “weekly”, “monthly”, “yearly”

  • drop_na – drop rows that contain NA values

Returns:

returns a named tuple with outputs (y), inputs (x), and training and testing indexes for the input-output paris

Gaussian process samples#

ramsey.data.sample_from_gaussian_process(rng_key, batch_size=10, num_observations=100, rho=None, sigma=None)[source]#

Sample from a Gaussian process.

Creates samples from a Gaussian process with exponentiated quadratic covariance function. For each batch, chooses a new hyperparameter configuration where rho, the kernel lengthscale is drawn from an InverseGamma(1, 1) and sigma, the kernel lengthscale, is drawn from an InverseGamma(5, 5).

The inputs, x of the Gaussian process have dimensionality \(b \times n \times 1\), where b is the batch size and n is the number of observations per batch. The outputs and latent functions realizations have dimension \(b \times n \times 1\) as well.

Parameters:
  • rng_key – a random key for seeding

  • batch_size – size of batch

  • num_observations – number of observations per batch

  • rho – the lengthscale of the kernel function

  • sigma – the standard deviation of the kernel function

Returns:

a tuple consisting of outputs (y), inputs (x) and latent GP realization (f) where

Noisy sine function samples#

ramsey.data.sample_from_sine_function(rng_key, batch_size=10, num_observations=100)[source]#

Sample from a noisy sine function.

Creates samples from a noisy sine functions. For each batch, chooses a new hyper-parameters configuration.

The inputs, x of the sine function have dimensionality \(b \times n \times 1\), where b is the batch size and n is the number of observations per batch. The outputs and latent functions realizations have dimension \(b \times n \times 1\) as well.

Parameters:
  • rng_key – a JAX random key for seeding

  • batch_size – size of batch

  • num_observations – number of observations per batch

  • rho – the lengthscale of the kernel function

  • sigma – the standard deviation of the kernel function

Returns:

a tuple consisting of outputs (y), inputs (x) and latent GP

realization (f) where