Package nltk_lite :: Package tag :: Module hmm :: Class HiddenMarkovModelTrainer
[show private | hide private]
[frames | no frames]

Type HiddenMarkovModelTrainer

object --+
         |
        HiddenMarkovModelTrainer


Algorithms for learning HMM parameters from training data. These include both supervised learning (MLE) and unsupervised learning (Baum-Welch).
Method Summary
  __init__(self, states, symbols)
Creates an HMM trainer to induce an HMM with the given states and output symbol alphabet.
HiddenMarkovModel train(self, labelled_sequences, unlabelled_sequences, **kwargs)
Trains the HMM using both (or either of) supervised and unsupervised techniques.
HiddenMarkovModel train_supervised(self, labelled_sequences, **kwargs)
Supervised training maximising the joint probability of the symbol and state sequences.
HiddenMarkovModel train_unsupervised(self, unlabelled_sequences, **kwargs)
Trains the HMM using the Baum-Welch algorithm to maximise the probability of the data sequence.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Method Details

__init__(self, states=None, symbols=None)
(Constructor)

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 - the set of state labels
           (type=sequence of any)
symbols - the set of observation symbols
           (type=sequence of any)
Overrides:
__builtin__.object.__init__

train(self, labelled_sequences=None, unlabelled_sequences=None, **kwargs)

Trains the HMM using both (or either of) supervised and unsupervised techniques.
Parameters:
labelled_sequences - the supervised training data, a set of labelled sequences of observations
           (type=list)
unlabelled_sequences - the unsupervised training data, a set of sequences of observations
           (type=list)
kwargs - additional arguments to pass to the training methods
Returns:
the trained model
           (type=HiddenMarkovModel)

train_supervised(self, labelled_sequences, **kwargs)

Supervised training maximising the joint probability of the symbol and state sequences. This is done via collecting frequencies of transitions between states, symbol observations while within each state and which states start a sentence. These frequency distributions are then normalised into probability estimates, which can be smoothed if desired.
Parameters:
labelled_sequences - the training data, a set of labelled sequences of observations
           (type=list)
kwargs - may include an 'estimator' parameter, a function taking a FreqDist and a number of bins and returning a ProbDistI; otherwise a MLE estimate is used
Returns:
the trained model
           (type=HiddenMarkovModel)

train_unsupervised(self, unlabelled_sequences, **kwargs)

Trains the HMM using the Baum-Welch algorithm to maximise the probability of the data sequence. This is a variant of the EM algorithm, and is unsupervised in that it doesn't need the state sequences for the symbols. The code is based on 'A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition', Lawrence Rabiner, IEEE, 1989.
Parameters:
unlabelled_sequences - the training data, a set of sequences of observations
           (type=list)
kwargs - may include the following parameters:
   model - a HiddenMarkovModel instance used to begin the Baum-Welch
       algorithm
   max_iterations - the maximum number of EM iterations
   convergence_logprob - the maximum change in log probability to
       allow convergence
Returns:
the trained model
           (type=HiddenMarkovModel)

Generated by Epydoc 2.1 on Tue Sep 5 09:37:22 2006 http://epydoc.sf.net