nltk.HiddenMarkovModelTrainer

class nltk.HiddenMarkovModelTrainer(states=None, symbols=None)[source]

Algorithms for learning HMM parameters from training data. These include both supervised learning (MLE) and unsupervised learning (Baum-Welch).

Creates an HMM trainer to induce an HMM with the given states and output symbol alphabet. A supervised and unsupervised training method may be used. If either of the states or symbols are not given, these may be derived from supervised training.

Parameters:
  • states (sequence of any) – the set of state labels
  • symbols (sequence of any) – the set of observation symbols

Methods

__init__([states, symbols])
train([labeled_sequences, unlabeled_sequences]) Trains the HMM using both (or either of) supervised and unsupervised techniques.
train_supervised(labelled_sequences[, estimator]) Supervised training maximising the joint probability of the symbol and state sequences.
train_unsupervised(unlabeled_sequences[, ...]) Trains the HMM using the Baum-Welch algorithm to maximise the probability of the data sequence.