Trees | Index | Help |
---|
Package Bio :: Module MarkovModel |
|
This is an implementation of a state-emitting MarkovModel. I am using terminology similar to Manning and Schutze.
Functions: train_bw Train a markov model using the Baum-Welch algorithm. train_visible Train a visible markov model using MLE. find_states Find the a state sequence that explains some observations.
load Load a MarkovModel. save Save a MarkovModel.
Classes: MarkovModel Holds the description of a markov modelClasses | |
---|---|
MarkovModel |
Function Summary | |
---|---|
find_states(markov_model, output) -> list of (states, score) | |
load(handle) -> MarkovModel() | |
save(mm, handle) | |
train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel | |
train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel |
Variable Summary | |
---|---|
float |
LOG0 = -690.77552789821368 |
str |
MATCODE = 'd'
|
int |
MAX_ITERATIONS = 1000 |
float |
VERY_SMALL_NUMBER = 1e-300 |
Function Details |
---|
find_states(markov_model, output)find_states(markov_model, output) -> list of (states, score) |
load(handle)load(handle) -> MarkovModel() |
save(mm, handle)save(mm, handle) |
train_bw(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None, update_fn=None)train_bw(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission][, update_fn]) -> MarkovModel Train a MarkovModel using the Baum-Welch algorithm. states is a list of strings that describe the names of each state. alphabet is a list of objects that indicate the allowed outputs. training_data is a list of observations. Each observation is a list of objects from the alphabet. pseudo_initial, pseudo_transition, and pseudo_emission are optional parameters that you can use to assign pseudo-counts to different matrices. They should be matrices of the appropriate size that contain numbers to add to each parameter matrix, before normalization. update_fn is an optional callback that takes parameters (iteration, log_likelihood). It is called once per iteration. |
train_visible(states, alphabet, training_data, pseudo_initial=None, pseudo_transition=None, pseudo_emission=None)train_visible(states, alphabet, training_data[, pseudo_initial] [, pseudo_transition][, pseudo_emission]) -> MarkovModel Train a visible MarkovModel using maximum likelihoood estimates for each of the parameters. states is a list of strings that describe the names of each state. alphabet is a list of objects that indicate the allowed outputs. training_data is a list of (outputs, observed states) where outputs is a list of the emission from the alphabet, and observed states is a list of states from states. pseudo_initial, pseudo_transition, and pseudo_emission are optional parameters that you can use to assign pseudo-counts to different matrices. They should be matrices of the appropriate size that contain numbers to add to each parameter matrix |
Variable Details |
---|
LOG0
|
MATCODE
|
MAX_ITERATIONS
|
VERY_SMALL_NUMBER
|
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Aug 10 20:05:35 2006 | http://epydoc.sf.net |