superstats.transition.stochastic.mixture#
Mixture transition models.
Classes
|
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:
StochasticTransitionMixture over multiple transitions, switching regimes at each step.
- Parameters:
- transitionssequence
ofTransition 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_weights
PriorortupleoffloatorNone,optional, default:None Fixed simplex weights, a dirichlet Prior to infer them per batch, or None for uniform weights over the components.
- bounds
tupleorNone,optional, default:None Lower and upper bounds for the latent state, shared across all component transitions.
- initial_prior
PriororNone,optional, default:None Prior for the initial latent state, shared across all component transitions. Required at sample time.
- namessequence
ofstrorNone,optional, default:None Names for each component, used to prefix hyperparameter keys. Defaults to each component’s transition_name.
- transitionssequence
- Raises:
ValueErrorIf 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.
TypeErrorIf 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:
- Returns:
- result
dict-dictionarywithkeyslocal_params, regimes, hyper_params, and fixed_params
- result
- Raises:
ValueErrorIf initial_prior was not specified in Mixture(…).
- Parameters:
- Return type: