Table of Contents

Class: KnownStateTrainer Bio/HMM/Trainer.py

Estimate probabilities with known state sequences.

This should be used for direct estimation of emission and transition probabilities when both the state path and emission sequence are known for the training examples.

Base Classes   
AbstractTrainer
Methods   
__init__
_count_emissions
_count_transitions
train
  __init__ 
__init__ ( self,  markov_model )

  _count_emissions 
_count_emissions (
        self,
        training_seq,
        emission_counts,
        )

Add emissions from the training sequence to the current counts.

Arguments:

  • training_seq -- A TrainingSequence with states and emissions to get the counts from

  • emission_counts -- The current emission counts to add to.

Exceptions   
KeyError("Unexpected emission (%s, %s)" %( cur_state, cur_emission ) )
  _count_transitions 
_count_transitions (
        self,
        state_seq,
        transition_counts,
        )

Add transitions from the training sequence to the current counts.

Arguments:

  • state_seq -- A Seq object with the states of the current training sequence.

  • transition_counts -- The current transition counts to add to.

Exceptions   
KeyError("Unexpected transition (%s, %s)" %( cur_state, next_state ) )
  train 
train ( self,  training_seqs )

Estimate the Markov Model parameters with known state paths.

This trainer requires that both the state and the emissions are known for all of the training sequences in the list of TrainingSequence objects. This training will then count all of the transitions and emissions, and use this to estimate the parameters of the model.


Table of Contents

This document was automatically generated on Mon Jul 1 12:03:09 2002 by HappyDoc version 2.0.1