osl_dynamics.simulation.HMM_Poisson#

class osl_dynamics.simulation.HMM_Poisson(n_samples, trans_prob, rates, n_states=None, n_channels=None, stay_prob=None)#

Bases: osl_dynamics.simulation.base.Simulation

HMM with a Poisson observation model.

Parameters:
n_samplesint

Number of samples to draw from the model.

trans_probnp.ndarray or str

Transition probability matrix as a numpy array or a str (‘sequence’, ‘uniform’) to generate a transition probability matrix.

ratesnp.ndarray or str

Poisson rate for each state and channel, shape (n_states, n_channels), or 'random'.

n_statesint, optional

Number of states. Needed if rates='random'.

n_channelsint, optional

Number of channels. Needed if rates='random'.

stay_probfloat, optional

Used to generate the transition probability matrix if trans_prob is a str.

hmm#
state_model#
obs_model#
n_samples#
n_sessions = None#
property n_states: int#

Number of states (simulations of mutually exclusive states only).

property n_modes: int#

Number of modes (simulations of modes only).

property state_time_course: numpy.ndarray#

State time course (simulations of mutually exclusive states only).

property mode_time_course: numpy.ndarray#

Mode time course (simulations of modes only).

standardize()#

Standardize the data and update the ground truth parameters.

Each channel is standardized over time. With session-specific parameters each session is standardized separately, otherwise the sessions are standardized together.

get_instantaneous_covariances()#

Get the ground truth covariance at each time point.

Returns:
inst_covsnp.ndarray

Instantaneous covariances. Shape is (n_samples, n_channels, n_channels), with a leading session dimension if there are multiple sessions.