Trees | Indices | Help |
---|
|
AbstractDPAlgorithms --+ | ScaledDPAlgorithms
Implement forward and backward algorithms using a rescaling approach.
This scales the f and b variables, so that they remain within a manageable numerical interval during calculations. This approach is described in Durbin et al. on p 78.
This approach is a little more straightfoward then log transformation but may still give underflow errors for some types of models. In these cases, the LogDPAlgorithms class should be used.
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from |
|
Initialize the scaled approach to calculating probabilities. Arguments: o markov_model -- The current Markov model we are working with. o sequence -- A TrainingSequence object that must have a set of emissions to work with.
|
Calculate the next scaling variable for a sequence position. This utilizes the approach of choosing s values such that the sum of all of the scaled f values is equal to 1. Arguments: o seq_pos -- The current position we are at in the sequence. o previous_vars -- All of the forward or backward variables calculated so far. Returns: o The calculated scaling variable for the sequence item. |
Calculate the value of the forward recursion. Arguments: o cur_state -- The letter of the state we are calculating the forward variable for. o sequence_pos -- The position we are at in the training seq. o forward_vars -- The current set of forward variables |
Calculate the value of the backward recursion Arguments: o cur_state -- The letter of the state we are calculating the forward variable for. o sequence_pos -- The position we are at in the training seq. o backward_vars -- The current set of backward variables
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Sep 22 19:31:55 2009 | http://epydoc.sourceforge.net |