osl_dynamics.models.scdynemo.Config#

class osl_dynamics.models.scdynemo.Config#

Bases: osl_dynamics.models.dynemo.Config

Settings for SC-DyNeMo.

The default initialization is init_method='random_subset' with n_init=5 and n_init_epochs=2.

Parameters:
model_namestr, optional

Model name.

n_modesint

Number of modes.

n_channelsint

Number of channels (time-delay embeddings).

sequence_lengthint

Length of the sequences passed to the model.

sampling_frequencyfloat

Sampling frequency of the data in Hz.

frequency_rangelist

Range of the initial oscillator frequencies in Hz.

inference_rnn_typestr, optional

RNN for the inference network. Either 'gru' or 'lstm'.

inference_n_layersint, optional

Number of layers in the inference network.

inference_n_unitsint

Number of units in each layer of the inference network.

inference_normalizationstr, optional

Normalization in the inference network. Either None, 'batch' or 'layer'.

inference_activationstr, optional

Activation in the inference network, after normalization and before dropout, e.g. 'relu' or 'elu'.

inference_dropoutfloat, optional

Dropout rate in the inference network.

inference_regularizerstr, optional

Keras regularizer for the inference network.

model_rnn_typestr, optional

RNN for the model network. Either 'gru' or 'lstm'.

model_n_layersint, optional

Number of layers in the model network.

model_n_unitsint

Number of units in each layer of the model network.

model_normalizationstr, optional

Normalization in the model network. Either None, 'batch' or 'layer'.

model_activationstr, optional

Activation in the model network, after normalization and before dropout.

model_dropoutfloat, optional

Dropout rate in the model network.

model_regularizerstr, optional

Keras regularizer for the model network.

learn_alpha_temperaturebool, optional

Should we learn the temperature of the softmax that calculates alpha from theta?

initial_alpha_temperaturefloat, optional

Initial value of the temperature.

learn_meansbool

Should we make the mean vectors trainable?

learn_covariancesbool

Should we make the covariance matrices trainable?

initial_meansnp.ndarray or str, optional

Initialization for the mean vectors. A str is a path to a .npy file.

initial_covariancesnp.ndarray or str, optional

Initialization for the covariance matrices. If diagonal_covariances=True and full matrices are passed, the diagonal is extracted. A str is a path to a .npy file.

covariances_epsilonfloat, optional

Value added to the diagonal of the covariances for numerical stability. Defaults to 1e-6 if learn_covariances=True, otherwise 0.

diagonal_covariancesbool, optional

Should we learn diagonal covariances?

means_regularizercallable, optional

Regularizer for the mean vectors. See osl_dynamics.inference.regularizers.

covariances_regularizercallable, optional

Regularizer for the covariance matrices.

kl_annealingbool, optional

Should we anneal the KL loss? The KL loss is multiplied by a factor that increases from 0 to 1 over the annealing epochs.

kl_annealing_curvestr, optional

Shape of the annealing curve. Either 'linear' or 'tanh'.

kl_annealing_sharpnessfloat, optional

Sharpness of the annealing curve if kl_annealing_curve='tanh'.

n_kl_annealing_epochsint, optional

Number of epochs for KL annealing.

theta_std_epsilonfloat, optional

Value added to the standard deviation of the distributions of theta.

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.