Trees | Indices | Help |
---|
|
An abstract class to calculate forward and backward probabiliies.
This class should not be instantiated directly, but should be used through a derived class which implements proper scaling of variables.
This class is just meant to encapsulate the basic foward and backward algorithms, and allow derived classes to deal with the problems of multiplying probabilities.
Derived class of this must implement:
o _forward_recursion -- Calculate the forward values in the recursion using some kind of technique for preventing underflow errors.
o _backward_recursion -- Calculate the backward values in the recursion step using some technique to prevent underflow errors.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
Initialize to calculate foward and backward probabilities. Arguments: o markov_model -- The current Markov model we are working with. o sequence -- A training sequence containing a set of emissions. |
Calculate sequence probability using the forward algorithm. This implements the foward algorithm, as described on p57-58 of Durbin et al. Returns: o A dictionary containing the foward variables. This has keys of the form (state letter, position in the training sequence), and values containing the calculated forward variable. o The calculated probability of the sequence. |
Calculate sequence probability using the backward algorithm. This implements the backward algorithm, as described on p58-59 of Durbin et al. Returns: o A dictionary containing the backwards variables. This has keys of the form (state letter, position in the training sequence), and values containing the calculated backward variable. |
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Sep 15 09:24:56 2008 | http://epydoc.sourceforge.net |