osl_dynamics.models.obs_mod.set_covariances_regularizer#

osl_dynamics.models.obs_mod.set_covariances_regularizer(model, range_, epsilon, scale_factor, diagonal=False, layer_name='covs')#

Set the covariances regularizer based on training data.

If config.diagonal_covariances is True, a log-normal prior is applied to the diagonal of the covariance matrices with mu=0, sigma=sqrt(log(2*range)). Otherwise, an inverse Wishart prior is applied to the covariance matrices with nu=n_channels-1+0.1, psi=diag(1/range).x

Parameters:
modelosl_dynamics.models.*.Model.model

The model.

range_np.ndarray

Range (max-min) of the training data for each channel. Shape is (n_channels,).

epsilonfloat

Error added to the covariance matrices.

scale_factorfloat

Scale factor for regularization.

diagonalbool, optional

Whether the covariances are diagonal.

layer_namestr, optional

Layer name of the covariances. Can be "covs" or "group_covs".