superstats.transition.stochastic.ornstein_uhlenbeck#

Ornstein-Uhlenbeck transition models.

Classes

OrnsteinUhlenbeck([bounds, initial_prior, ...])

Ornstein-Uhlenbeck mean-reverting transition.

class superstats.transition.stochastic.ornstein_uhlenbeck.OrnsteinUhlenbeck(bounds=None, initial_prior=None, sigma=None, mu=None, theta=None)[source]#

Bases: StochasticTransition

Ornstein-Uhlenbeck mean-reverting transition.

Parameters:
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.

sigmafloat or Prior or None, optional, default: None

Diffusion scale.

mufloat or Prior or None, optional, default: None

Long-run mean to revert towards.

thetafloat or Prior or None, optional, default: None

Mean-reversion speed.

Parameters:

Notes

Implements an OU process: x_t = x_{t-1} + theta * (mu - x_{t-1}) + sigma * eps_t.

sample(batch_size, num_steps)[source]#

Draw batch_size Ornstein-Uhlenbeck 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]

sample_one_step(x, params)[source]#

Advance a single OU step.

Parameters:
xfloat

Previous latent state.

paramsdict

Expected keys: mu, theta, sigma.

Returns:
x_nextfloat - the next latent state
Parameters:
Return type:

float