glhmm.io#

Input/output functions - Gaussian Linear Hidden Markov Model @author: Diego Vidaurre 2023

glhmm.io.load_files(files, I=None, do_only_indices=False)[source]#

Loads data from files and returns the loaded data, indices, and individual indices for each file.

glhmm.io.load_hmm(filename)[source]#

Loads a glhmm object from filename

glhmm.io.load_statistics(file_name, load_directory=None)[source]#

Load statistics data from a file.

Parameters:
  • file_name (str) – The name of the file containing the saved statistics data, with or without extension.

  • load_directory (str, optional) – The directory path where the file is located (default is the current working directory).

Returns:

data_dict – The dictionary containing the loaded statistics data.

Return type:

dict

Raises:
  • FileNotFoundError – If the specified file does not exist.

  • ValueError – If an unsupported file format is encountered.

glhmm.io.read_flattened_hmm_mat(file)[source]#

Reads a MATLAB file containing hidden Markov model (HMM) parameters, and initializes a Gaussian linear hidden Markov model (GLHMM) using those parameters.

glhmm.io.save_hmm(hmm, filename)[source]#

Saves a glhmm object on filename

glhmm.io.save_statistics(data_dict, file_name='statistics', save_directory=None, format='npy')[source]#

Save statistics data to a file in the specified directory with optional format (npy or npz).

Parameters:
  • data_dict (dict) – The dictionary containing statistics data to be saved.

  • file_name (str, optional) – The name of the file (default is ‘statistics’).

  • save_directory (str, optional) – The directory path where the file will be saved (default is the current working directory).

  • format (str) – The serialization format (‘npy’ or ‘npz’, default is ‘npy’).

Return type:

None