osl_dynamics.simulation.mvn
#
Multivariate normal observation model.
Module Contents#
Classes#
Class that generates data from a multivariate normal distribution. |
|
Class that generates data from a multivariate normal distribution. |
|
Class that generates data from a multivariate normal distribution for |
- class osl_dynamics.simulation.mvn.MVN(means, covariances, n_modes=None, n_channels=None, n_covariances_act=1, observation_error=0.0)[source]#
Class that generates data from a multivariate normal distribution.
- Parameters:
means (np.ndarray or str) – Mean vector for each mode, shape should be (n_modes, n_channels). Either a numpy array or
'zero'
or'random'
.covariances (np.ndarray or str) – Covariance matrix for each mode, shape should be (n_modes, n_channels, n_channels). Either a numpy array or
'random'
.n_modes (int, optional) – Number of modes.
n_channels (int, optional) – Number of channels.
n_covariances_act (int, optional) – Number of iterations to add activations to covariance matrices.
observation_error (float, optional) – Standard deviation of the error added to the generated data.
- simulate_data(state_time_course)[source]#
Simulate time series data.
- Parameters:
state_time_course (np.ndarray) – 2D array containing state activations. Shape must be (n_samples, n_states).
- Returns:
data – Time series data. Shape is (n_samples, n_channels).
- Return type:
np.ndarray
- get_instantaneous_covariances(state_time_course)[source]#
Get the ground truth covariance at each time point.
- Parameters:
state_time_course (np.ndarray) – 2D array containing state activations. Shape must be (n_samples, n_states).
- Returns:
inst_covs – Instantaneous covariances. Shape is (n_samples, n_channels, n_channels).
- Return type:
np.ndarray
- class osl_dynamics.simulation.mvn.MDyn_MVN(means, covariances, n_modes=None, n_channels=None, n_covariances_act=1, observation_error=0.0)[source]#
Bases:
MVN
Class that generates data from a multivariate normal distribution.
Multi-time-scale version of MVN.
- Parameters:
means (np.ndarray or str) – Mean vector for each mode, shape should be (n_modes, n_channels). Either a numpy array or
'zero'
or'random'
.covariances (np.ndarray or str) – Covariance matrix for each mode, shape should be (n_modes, n_channels, n_channels). Either a numpy array or
'random'
.n_modes (int, optional) – Number of modes.
n_channels (int, optional) – Number of channels.
n_covariances_act (int, optional) – Number of iterations to add activations to covariance matrices.
observation_error (float, optional) – Standard deviation of the error added to the generated data.
- simulate_data(state_time_courses)[source]#
Simulates data.
- Parameters:
state_time_courses (np.ndarray) – Should contain two time courses: one for the mean and standard deviations and another for functional connectiivty. Shape is (2, n_samples, n_modes).
- Returns:
data – Simulated data. Shape is (n_samples, n_channels).
- Return type:
np.ndarray
- get_instantaneous_covariances(state_time_courses)[source]#
Get the ground truth covariance at each time point.
- Parameters:
state_time_courses (np.ndarray) – Should contain two time courses: one for the mean and standard deviations and another for functional connectiivty. Shape is (2, n_samples, n_modes).
- Returns:
inst_covs – Instantaneous covariances. Shape is (n_samples, n_channels, n_channels).
- Return type:
np.ndarray
- class osl_dynamics.simulation.mvn.MSess_MVN(session_means, session_covariances, n_modes=None, n_channels=None, n_covariances_act=1, embedding_vectors=None, n_sessions=None, embeddings_dim=None, spatial_embeddings_dim=None, embeddings_scale=None, n_groups=None, between_group_scale=None, observation_error=0.0)[source]#
Bases:
MVN
Class that generates data from a multivariate normal distribution for multiple sessions.
- Parameters:
session_means (np.ndarray or str) – Mean vector for each mode for each session, shape should be (n_sessions, n_modes, n_channels). Either a numpy array or
'zero'
or'random'
.session_covariances (np.ndarray or str) – Covariance matrix for each mode for each session, shape should be (n_sessions, n_modes, n_channels, n_channels). Either a numpy array or
'random'
.n_modes (int, optional) – Number of modes.
n_channels (int, optional) – Number of channels.
n_covariances_act (int, optional) – Number of iterations to add activations to covariance matrices.
embedding_vectors (np.ndarray, optional) – Embedding vectors for each session, shape should be (n_sessions, embeddings_dim).
n_sessions (int, optional) – Number of sessions.
embeddings_dim (int, optional) – Dimension of embeddings.
spatial_embeddings_dim (int, optional) – Dimension of spatial embeddings.
embeddings_scale (float, optional) – Standard deviation when generating embeddings with a normal distribution.
n_groups (int, optional) – Number of groups when generating embeddings.
between_group_scale (float, optional) – Standard deviation when generating centroids of groups of embeddings.
observation_error (float, optional) – Standard deviation of the error added to the generated data.
- simulate_session_data(session, mode_time_course)[source]#
Simulate single session data.
- Parameters:
session (int) – Session number.
mode_time_course (np.ndarray) – Mode time course. Shape is (n_samples, n_modes).
- Returns:
data – Simulated data. Shape is (n_samples, n_channels).
- Return type:
np.ndarray
- get_session_instantaneous_covariances(session, mode_time_course)[source]#
Get ground truth covariances at each time point for a particular session.
- Parameters:
session (int) – Session number.
mode_time_course (np.ndarray) – Mode time course. Shape is (n_samples, n_modes).
- Returns:
inst_covs – Instantaneous covariances for an session. Shape is (n_samples, n_channels, n_channels).
- Return type:
np.ndarray
- get_instantaneous_covariances(mode_time_courses)[source]#
Get ground truth covariance at each time point for each session.
- Parameters:
mode_time_courses (np.ndarray) – Mode time courses. Shape is (n_sessions, n_samples, n_modes).
- Returns:
inst_covs – Instantaneous covariances. Shape is (n_sessions, n_samples, n_channels, n_channels).
- Return type:
np.ndarray
- simulate_multi_session_data(mode_time_courses)[source]#
Simulates data.
- Parameters:
mode_time_courses (np.ndarray) – It contains n_sessions time courses. Shape is (n_sessions, n_samples, n_modes).
- Returns:
data – Simulated data for sessions. Shape is (n_sessions, n_samples, n_channels).
- Return type:
np.ndarray