superstats.transition.stochastic.gaussian_process#

Gaussian-process transition models.

Functions

sample_gaussian_process(local_params, start, ...)

Vectorized Gaussian process rollout across a batch, filled in place.

Classes

GaussianProcess([kernel, kernel_params, ...])

Gaussian process transition model.

class superstats.transition.stochastic.gaussian_process.GaussianProcess(kernel='rbf', kernel_params=None, bounds=None, initial_prior=None)[source]#

Bases: StochasticTransition

Gaussian process transition model.

Draws each trajectory as a GP sample with mean start (from initial_prior) and covariance from kernel, then squashes the result into bounds via a scaled sigmoid.

Parameters:
kernel{“rbf”, “linear”} or Kernel, default “rbf”

Kernel used to build the covariance matrix. Either a registered name or a Kernel instance, including composites built via +/* (e.g. RBFKernel(name=”trend”) + RBFKernel(name=”local”)).

kernel_paramsdict, optional

Maps kernel hyperparameter names (see kernel.hyperparam_names, e.g. “length_scale”, “amplitude” for the default RBF kernel) to a Prior (sampled per-batch) or a fixed float. Any name not given here falls back to DEFAULT_HYPER_PRIORS, same as RandomWalk’s sigma/delta. Combining two kernels of the same type requires an explicit name= on each (see Kernel), which prefixes their hyperparameter names accordingly.

boundstuple or None, optional, default: None

Lower and upper bounds for the latent state.

initial_priorPrior or None, optional, default: None

Prior for the initial latent state.

Parameters:
  • kernel (Literal['rbf', 'linear', 'periodic'] | ~superstats.transition.stochastic.kernel.kernel.Kernel)

  • kernel_params (Dict[str, Prior | float | int | None] | None)

  • bounds (Sequence[float] | None)

  • initial_prior (Prior | None)

Notes

The sample method returns a dict with keys local_params, hyper_params and fixed_params, matching RandomWalk.

sample(batch_size, num_steps)[source]#

Draw batch_size Gaussian process trajectories of length num_steps.

Parameters:
batch_sizeint

Number of independent trajectories to draw.

num_stepsint

Number of time steps per trajectory.

Returns:
resultdict - dictionary with keys local_params,

hyper_params, and fixed_params

Parameters:
  • batch_size (int)

  • num_steps (int)

Return type:

Dict[str, Any]

superstats.transition.stochastic.gaussian_process.sample_gaussian_process(local_params, start, kernel_mat, bounds, noise=1e-06)[source]#

Vectorized Gaussian process rollout across a batch, filled in place.

Parameters:
local_paramsnp.ndarray of shape (batch_size, steps)

Pre-allocated output array; filled in place with the bounded rollout.

startnp.ndarray of shape (batch_size,)

Initial state per trajectory, used as the GP sample mean.

kernel_matnp.ndarray of shape (batch_size, steps, steps)

Covariance kernel matrix, per trajectory.

boundsnp.ndarray of shape (2,)

(lower, upper) bounds passed to scaled_sigmoid.

noisefloat, default 1e-6

Jitter added to the kernel diagonal for numerical stability during Cholesky decomposition.

Returns:
local_paramsnp.ndarray of shape (batch_size, steps) - the same

array, filled with the bounded Gaussian process rollout

Parameters:
Return type:

ndarray