Package Bio :: Package HMM :: Module Trainer :: Class AbstractTrainer
[hide private]
[frames] | no frames]

Class AbstractTrainer

source code

object --+
         |
        AbstractTrainer
Known Subclasses:

Provide generic functionality needed in all trainers.
Instance Methods [hide private]
 
__init__(self, markov_model)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
log_likelihood(self, probabilities)
Calculate the log likelihood of the training seqs.
source code
 
estimate_params(self, transition_counts, emission_counts)
Get a maximum likelihood estimation of transition and emmission.
source code
 
ml_estimator(self, counts)
Calculate the maximum likelihood estimator.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, markov_model)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

log_likelihood(self, probabilities)

source code 

Calculate the log likelihood of the training seqs.

Arguments:

o probabilities -- A list of the probabilities of each training sequence under the current parameters, calculated using the forward algorithm.

estimate_params(self, transition_counts, emission_counts)

source code 

Get a maximum likelihood estimation of transition and emmission.

Arguments:

o transition_counts -- A dictionary with the total number of counts of transitions between two states.

o emissions_counts -- A dictionary with the total number of counts of emmissions of a particular emission letter by a state letter.

This then returns the maximum likelihood estimators for the transitions and emissions, estimated by formulas 3.18 in Durbin et al:

a_{kl} = A_{kl} / sum(A_{kl'}) e_{k}(b) = E_{k}(b) / sum(E_{k}(b'))

Returns: Transition and emission dictionaries containing the maximum likelihood estimators.

ml_estimator(self, counts)

source code 

Calculate the maximum likelihood estimator.

This can calculate maximum likelihoods for both transitions and emissions.

Arguments:

o counts -- A dictionary of the counts for each item.

See estimate_params for a description of the formula used for calculation.