osl_dynamics.models.hmm_poisson.Config#

class osl_dynamics.models.hmm_poisson.Config#

Bases: osl_dynamics.models.base.configs.ConfigBase, osl_dynamics.models.base.configs.MarkovConfig

Settings for HMM-Poisson.

The default initialization is init_method='random_state_time_course' with n_init=3 and n_init_epochs=1.

Parameters:
model_namestr, optional

Model name.

n_statesint

Number of states.

n_channelsint

Number of channels.

sequence_lengthint

Length of the sequences passed to the model.

learn_log_ratesbool

Should we make the log-rates trainable?

initial_log_ratesnp.ndarray or str, optional

Initialization for the log-rates. Shape must be (n_states, n_channels). A str is a path to a .npy file.

initial_trans_probnp.ndarray or str, optional

Initialization for the transition probability matrix. A str is a path to a .npy file.

learn_trans_probbool, optional

Should we update the transition probability matrix?

trans_prob_priornp.ndarray or str, optional

Dirichlet prior for the transition probability matrix. Each row is the alpha parameters of the Dirichlet distribution. A str is a path to a .npy file.

trans_prob_update_delayfloat, optional

The transition probability matrix is updated with trans_prob = (1 - rho) * trans_prob + rho * estimate, where rho = (100 * epoch / n_epochs + 1 + trans_prob_update_delay) ** -trans_prob_update_forget. This is the delay parameter.

trans_prob_update_forgetfloat, optional

Forget parameter for the update of the transition probability matrix.

initial_state_probsnp.ndarray or str, optional

State probabilities at time=0. A str is a path to a .npy file.

learn_initial_state_probsbool, optional

Should we update the initial state probabilities?

baum_welch_implementationstr, optional

Implementation of the Baum-Welch algorithm. Either 'log' or 'rescale'.

init_methodstr, optional

Initialization method used by initialization and train: 'random_state_time_course', 'random_subset', 'nfindr' or 'single_subject'.

n_initint, optional

Number of initializations.

n_init_epochsint, optional

Number of epochs for each initialization.

init_takefloat, optional

Fraction of the dataset to use in the initialization.

batch_sizeint

Mini-batch size.

learning_ratefloat

Learning rate.

learning_rate_decayfloat, optional

Decay of the learning rate. In epoch e, the learning rate is learning_rate * exp(-learning_rate_decay * e), where e is counted from the end of KL annealing in models that use it.

gradient_clipfloat, optional

Value to clip gradients by. This is the clipnorm argument passed to the Keras optimizer.

n_epochsint

Number of training epochs.

optimizerstr, optional

Name of a Keras optimizer.

optimizer_kwargsdict, optional

Keyword arguments for the optimizer.

loss_reductionstr, optional

How should we reduce the time dimension in the loss? Either 'mean' or 'sum'.

multi_gpubool, optional

Should we use multiple GPUs for training? If so, the last batch of an epoch is dropped if it is smaller than batch_size (for a Data object or a dataset from osl_dynamics.data.load_tfrecord_dataset()).

best_ofint, optional

Number of full training runs in train. Each run includes its own initialization. The run with the lowest free energy is kept.