Trees | Indices | Help |
---|
|
Represent a hidden markov model that can be used for state estimation.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
Initialize a Markov Model. Note: You should use the MarkovModelBuilder class instead of initiating this class directly. Arguments: o transition_prob -- A dictionary of transition probabilities for all possible transitions in the sequence. o emission_prob -- A dictionary of emissions probabilities for all possible emissions from the sequence states. o transition_pseudo -- Pseudo-counts to be used for the transitions, when counting for purposes of estimating transition probabilities. o emission_pseduo -- Pseudo-counts fo tbe used for the emissions, when counting for purposes of estimating emission probabilities. |
Calculate which 'from transitions' are allowed for each letter. This looks through all of the trans_probs, and uses this dictionary to determine allowed transitions. It converts this information into a dictionary, whose keys are the transition letters and whose values are a list of allowed letters to transition to. |
Get the default transitions for the model. Returns a dictionary of all of the default transitions between any two letters in the sequence alphabet. The dictionary is structured with keys as (letter1, letter2) and values as the starting number of transitions. |
Get the starting default emmissions for each sequence. This returns a dictionary of the default emmissions for each letter. The dictionary is structured with keys as (seq_letter, emmission_letter) and values as the starting number of emmissions. |
Get all transitions which can happen from the given state. This returns all letters which the given state_letter is allowed to transition to. An empty list is returned if no letters are possible. |
Calculate the most probable state path using the Viterbi algorithm. This implements the Viterbi algorithm (see pgs 55-57 in Durbin et al for a full explanation -- this is where I took my implementation ideas from), to allow decoding of the state path, given a sequence of emissions. Arguments: o sequence -- A Seq object with the emission sequence that we want to decode. o state_alphabet -- The alphabet of the possible state sequences that can be generated. |
Return log transform of the given probability dictionary. When calculating the Viterbi equation, we need to deal with things as sums of logs instead of products of probabilities, so that we don't get underflow errors.. This copies the given probability dictionary and returns the same dictionary with everything transformed with a log. |
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Dec 25 10:56:32 2008 | http://epydoc.sourceforge.net |