osl_dynamics.analysis.fisher_kernel#

Implementation of the Fisher kernel for prediction studies.

See the HMM description for further details.

See also

Example script applying the Fisher kernel to simulated HMM data.

Classes#

FisherKernel

Class for computing the Fisher kernel matrix given a generative model.

Module Contents#

class osl_dynamics.analysis.fisher_kernel.FisherKernel(model)[source]#

Class for computing the Fisher kernel matrix given a generative model.

Parameters:

model (osl-dynamics model) – Model. Currently only the HMM, DyNeMo and M-DyNeMo are implemented.

model[source]#
get_features(dataset, batch_size=None)[source]#

Get the Fisher features.

Parameters:
  • dataset (osl_dynamics.data.Data) – Data.

  • batch_size (int, optional) – Batch size. If None, we use model.config.batch_size.

Returns:

features – Fisher kernel matrix. Shape is (n_sessions, n_features).

Return type:

np.ndarray

get_kernel_matrix(dataset, batch_size=None)[source]#

Get the Fisher kernel matrix.

Parameters:
  • dataset (osl_dynamics.data.Data) – Data.

  • batch_size (int, optional) – Batch size. If None, we use model.config.batch_size.

Returns:

kernel_matrix – Fisher kernel matrix. Shape is (n_sessions, n_sessions).

Return type:

np.ndarray