Hidden Markov Model (HMM) Training
>>> from mlpack import hmm_train
This program allows a Hidden Markov Model to be trained on labeled or unlabeled data. It support three types of HMMs: discrete HMMs, Gaussian HMMs, or GMM HMMs.
Either one input sequence can be specified (with --input_file), or, a file containing files in which input sequences can be found (when --input_file and --batch are used together). In addition, labels can be provided in the file specified by --labels_file, and if --batch is used, the file given to --labels_file should contain a list of files of labels corresponding to the sequences in the file given to --input_file.
The HMM is trained with the Baum-Welch algorithm if no labels are provided. The tolerance of the Baum-Welch algorithm can be set with the --tolerance option. By default, the transition matrix is randomly initialized and the emission distributions are initialized to fit the extent of the data.
Optionally, a pre-created HMM model can be used as a guess for the transition matrix and emission probabilities; this is specifiable with --model_file.
- input_file (string): [required] File containing input observations. Default value .
- batch (bool): If true, input_file (and if passed, labels_file) are expected to contain a list of files to use as input observation sequences (and label sequences).
- copy_all_inputs (bool): If specified, all input parameters will be deep copied before the method is run. This is useful for debugging problems where the input parameters are being modified by the algorithm, but can slow down the code.
- gaussians (int): Number of gaussians in each GMM (necessary when type is 'gmm'). Default value 0.
- input_model (mlpack.HMMModelType): Pre-existing HMM model to initialize training with.
- labels_file (string): Optional file of hidden states, used for labeled training. Default value .
- seed (int): Random seed. If 0, 'std::time(NULL)' is used. Default value 0.
- states (int): Number of hidden states in HMM (necessary, unless model_file is specified). Default value 0.
- tolerance (float): Tolerance of the Baum-Welch algorithm. Default value 1e-05.
- type (string): Type of HMM: discrete | gaussian | gmm. Default value gaussian.
- verbose (bool): Display informational messages and the full list of parameters and timers at the end of execution.
The return value from the binding is a dict containing the following elements:
- output_model (mlpack.HMMModelType): Output for trained HMM.