biopython v1.71.0 Bio.MarkovModel

A state-emitting MarkovModel.

Note terminology similar to Manning and Schutze is used.

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 model

Link to this section Summary

Functions

Return indeces of the maximum values aong the vector (PRIVATE)

Implement backward algorithm

Implement the Baum-Welch algorithm to evaluate unknown parameters in the MarkovModel object (PRIVATE)

Execute one step for Baum-Welch algorithm (PRIVATE)

Copy a matrix and check its dimension. Normalize at the end (PRIVATE)

Return the exponential of a logsum (PRIVATE)

Implement forward algorithm (PRIVATE)

Implement logsum for a matrix object (PRIVATE)

Implement a log sum for two vector objects (PRIVATE)

Implement Maximum likelihood estimation algorithm (PRIVATE)

Normalize matrix object (PRIVATE)

Normalize a random matrix (PRIVATE)

Read the first line and evaluate that begisn with the correct start (PRIVATE)

Normalize a uniform matrix (PRIVATE)

Implement Viterbi algorithm to find most likely states for a given input (PRIVATE)

Find states in the given Markov model output

Return a dictionary of values with their sequence offset as keys

Parse a file handle into a MarkovModel object

Implement logaddexp method if Numpy version is older than 1.3

Save MarkovModel object into handle

Train a MarkovModel using the Baum-Welch algorithm

Train a visible MarkovModel using maximum likelihoood estimates for each of the parameters

Link to this section Functions

Return indeces of the maximum values aong the vector (PRIVATE).

Implement backward algorithm.

Implement the Baum-Welch algorithm to evaluate unknown parameters in the MarkovModel object (PRIVATE).

Link to this function _baum_welch_one()

Execute one step for Baum-Welch algorithm (PRIVATE).

Do one iteration of Baum-Welch based on a sequence of output. Changes the value for lp_initial, lp_transition and lp_emission in place.

Link to this function _copy_and_check()

Copy a matrix and check its dimension. Normalize at the end (PRIVATE).

Return the exponential of a logsum (PRIVATE).

Implement forward algorithm (PRIVATE).

Calculate a Nx(T+1) matrix, where the last column is the total probability of the output.

Implement logsum for a matrix object (PRIVATE).

Implement a log sum for two vector objects (PRIVATE).

Implement Maximum likelihood estimation algorithm (PRIVATE).

Normalize matrix object (PRIVATE).

Normalize a random matrix (PRIVATE).

Link to this function _readline_and_check_start()

Read the first line and evaluate that begisn with the correct start (PRIVATE).

Link to this function _uniform_norm()

Normalize a uniform matrix (PRIVATE).

Implement Viterbi algorithm to find most likely states for a given input (PRIVATE).

Find states in the given Markov model output.

Returns a list of (states, score) tuples.

Return a dictionary of values with their sequence offset as keys.

Parse a file handle into a MarkovModel object.

Implement logaddexp method if Numpy version is older than 1.3.

Save MarkovModel object into handle.

Train a MarkovModel using the Baum-Welch algorithm.

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.

Link to this function train_visible()

Train a visible MarkovModel using maximum likelihoood estimates for each of the parameters.

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.