superstats.transition.stochastic.stochastic_transition#

Base stochastic transition interface.

Classes

StochasticTransition([bounds, initial_prior])

Base class for stochastic transition models.

class superstats.transition.stochastic.stochastic_transition.StochasticTransition(bounds=None, initial_prior=None)[source]#

Bases: ABC

Base class for stochastic transition models.

Subclasses implement deterministic dynamics for a single scalar latent parameter. Subclasses must implement sample to generate complete trajectories from resolved parameter values.

Parameters:
boundstuple or np.ndarray or None, optional, default: None

Lower and upper bounds for the latent state, applied via scaled_sigmoid. Falls back to DEFAULT_BOUNDS if not provided.

initial_priorPrior or None, optional, default: None

Prior used to draw initial latent states. Falls back to DEFAULT_INITIAL_PRIOR if not provided.

Attributes:
boundsnp.ndarray

Resolved lower and upper bounds for the latent state.

initial_priorPrior

Resolved prior used to draw initial latent states.

hyper_specsdict

Mapping from hyperparameter names to either a Prior (to be sampled per-batch) or a scalar fixed value. Populated by subclasses.

transition_namestr

Short model name, such as "rw" or "ar1".

Parameters:
dtype#

alias of float32

abstract sample(batch_size, num_steps)[source]#

Generate batch_size latent trajectories of length num_steps.

Parameters:
batch_sizeint

Number of independent trajectories to draw.

num_stepsint

Number of time steps per trajectory (including initial state).

Returns:
resultdict - dictionary with at least keys local_params

(ndarray of shape (batch_size, steps)), hyper_params, and fixed_params describing sampled and fixed hyperparameters

Parameters:
  • batch_size (int)

  • num_steps (int)

Return type:

Dict[str, Any]