Skip to content

ramsey.data

Functionality for loading and sampling data sets.

ramsey.data.m4_data(interval: str = 'hourly', drop_na: bool = True)

Load a data set from the M4 competition.

Parameters:

Name Type Description Default
interval str

either of "hourly", "daily", "weekly", "monthly", "yearly"

'hourly'
drop_na bool

drop rows that contain NA values

True

Returns:

Type Description
NamedTuple

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

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

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 :math: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 :math:b \times n \times 1 as well.

Parameters:

Name Type Description Default
rng_key

a random key for seeding

required
batch_size

size of batch

10
num_observations

number of observations per batch

100
rho

the lengthscale of the kernel function

None
sigma

the standard deviation of the kernel function

None

Returns:

Type Description
NamedTuple

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

ramsey.data.sample_from_sine_function(rng_key, batch_size=10, num_observations=100)

Sample from a noisy sine function.

Creates samples from a noisy sine functions. For each batch, chooses a new hyperparameters configuration.

The inputs, x of the sine function have dimensionality :math: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 :math:b \times n \times 1 as well.

Parameters:

Name Type Description Default
rng_key

a random key for seeding

required
batch_size

size of batch

10
num_observations

number of observations per batch

100
rho

the lengthscale of the kernel function

required
sigma

the standard deviation of the kernel function

required

Returns:

Type Description
NamedTuple

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