Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::HMM::MarkovModel::MarkovModelBuilder::set_equal_probabilities (   self  ) 

Reset all probabilities to be an average value.

This resets the values of all allowed transitions and all allowed
emissions to be equal to 1 divided by the number of possible elements.

This is useful if you just want to initialize a Markov Model to
starting values (ie. if you have no prior notions of what the
probabilities should be -- or if you are just feeling too lazy
to calculate them :-).

Warning 1 -- this will reset all currently set probabilities.

Warning 2 -- This just sets all probabilities for transitions and
emissions to total up to 1, so it doesn't ensure that the sum of
each set of transitions adds up to 1.

Definition at line 93 of file MarkovModel.py.

00093                                      :
        """Reset all probabilities to be an average value.

        This resets the values of all allowed transitions and all allowed
        emissions to be equal to 1 divided by the number of possible elements.

        This is useful if you just want to initialize a Markov Model to
        starting values (ie. if you have no prior notions of what the
        probabilities should be -- or if you are just feeling too lazy
        to calculate them :-).

        Warning 1 -- this will reset all currently set probabilities.

        Warning 2 -- This just sets all probabilities for transitions and
        emissions to total up to 1, so it doesn't ensure that the sum of
        each set of transitions adds up to 1.
        """
        # first set the transitions
        new_trans_prob = float(1) / float(len(self.transition_prob.keys()))
        for key in self.transition_prob.keys():
            self.transition_prob[key] = new_trans_prob

        # now set the emissions
        new_emission_prob = float(1) / float(len(self.emission_prob.keys()))
        for key in self.emission_prob.keys():
            self.emission_prob[key] = new_emission_prob
            

    def set_random_probabilities(self):


Generated by  Doxygen 1.6.0   Back to index