superstats.transition.stochastic.random_walk#

Random-walk transition model.

Classes

RandomWalk([bounds, initial_prior, sigma, delta])

Random walk transition with Gaussian noise and optional drift.

class superstats.transition.stochastic.random_walk.RandomWalk(bounds=None, initial_prior=None, sigma=None, delta=None)[source]#

Bases: StochasticTransition

Random walk transition with Gaussian noise and optional drift.

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

Standard deviation of the Gaussian increments.

deltafloat or Prior, optional, default: 0.0

Additive drift term.

Parameters:

Notes

The sample method returns a dict with keys local_params, hyper_params and fixed_params. Use sample_one_step to advance a single time-step given numeric params.

sample(batch_size, num_steps)[source]#

Draw batch_size random-walk 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 step of the random walk.

Parameters:
xfloat

Previous latent state.

paramsdict

Expected keys: sigma, delta.

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

float