superstats.transition.stochastic.mixture#

Mixture transition models.

Classes

Mixture(transitions[, mixture_weights, ...])

Mixture over multiple transitions, switching regimes at each step.

class superstats.transition.stochastic.mixture.Mixture(transitions, mixture_weights=None, bounds=None, initial_prior=None, names=None)[source]#

Bases: StochasticTransition

Mixture over multiple transitions, switching regimes at each step.

Parameters:
transitionssequence of Transition

The component transitions to mix between. Must contain at least two. Each transition must not define its own bounds or initial_prior (these are shared with the mixture instead); a Jump component must use p_jump=1 since mixture weights already define the jump probability.

mixture_weightsPrior or tuple of float or None, optional, default: None

Fixed simplex weights, a dirichlet Prior to infer them per batch, or None for uniform weights over the components.

boundstuple or None, optional, default: None

Lower and upper bounds for the latent state, shared across all component transitions.

initial_priorPrior or None, optional, default: None

Prior for the initial latent state, shared across all component transitions. Required at sample time.

namessequence of str or None, optional, default: None

Names for each component, used to prefix hyperparameter keys. Defaults to each component’s transition_name.

Raises:
ValueError

If fewer than two transitions are given, if any transition defines its own bounds or initial_prior, if a Jump component defines p_jump, if names doesn’t match the number of transitions, or if mixture_weights is a list/tuple with the wrong length or negative values.

TypeError

If mixture_weights is a scalar, or not one of tuple/list/Prior/None.

Parameters:
sample(batch_size, num_steps)[source]#

Draw batch_size mixture 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, regimes,

hyper_params, and fixed_params

Raises:
ValueError

If initial_prior was not specified in Mixture(…).

Parameters:
  • batch_size (int)

  • num_steps (int)

Return type:

Dict[str, Any]