Trees | Index | Help |
---|
Package Bio :: Package HMM :: Module DynamicProgramming :: Class AbstractDPAlgorithms |
|
LogDPAlgorithms
,
ScaledDPAlgorithms
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.Method Summary | |
---|---|
Initialize to calculate foward and backward probabilities. | |
Calculate sequence probability using the backward algorithm. | |
Calculate sequence probability using the forward algorithm. | |
Calculate the backward recursion value. | |
Calculate the forward recursion value. |
Method Details |
---|
__init__(self,
markov_model,
sequence)
|
backward_algorithm(self)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. |
forward_algorithm(self)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. |
_backward_recursion(self, cur_state, sequence_pos, forward_vars)Calculate the backward recursion value. |
_foward_recursion(self, cur_state, sequence_pos, forward_vars)Calculate the forward recursion value. |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Aug 10 20:01:14 2006 | http://epydoc.sf.net |