MCPcopy
hub / github.com/nltk/nltk / MLEProbDist

Class MLEProbDist

nltk/probability.py:764–807  ·  view source on GitHub ↗

The maximum likelihood estimate for the probability distribution of the experiment used to generate a frequency distribution. The "maximum likelihood estimate" approximates the probability of each sample as the frequency of that sample in the frequency distribution.

Source from the content-addressed store, hash-verified

762
763
764class MLEProbDist(ProbDistI):
765 """
766 The maximum likelihood estimate for the probability distribution
767 of the experiment used to generate a frequency distribution. The
768 "maximum likelihood estimate" approximates the probability of
769 each sample as the frequency of that sample in the frequency
770 distribution.
771 """
772
773 def __init__(self, freqdist, bins=None):
774 """
775 Use the maximum likelihood estimate to create a probability
776 distribution for the experiment used to generate ``freqdist``.
777
778 :type freqdist: FreqDist
779 :param freqdist: The frequency distribution that the
780 probability estimates should be based on.
781 """
782 self._freqdist = freqdist
783
784 def freqdist(self):
785 """
786 Return the frequency distribution that this probability
787 distribution is based on.
788
789 :rtype: FreqDist
790 """
791 return self._freqdist
792
793 def prob(self, sample):
794 return self._freqdist.freq(sample)
795
796 def max(self):
797 return self._freqdist.max()
798
799 def samples(self):
800 return self._freqdist.keys()
801
802 def __repr__(self):
803 """
804 :rtype: str
805 :return: A string representation of this ``ProbDist``.
806 """
807 return "<MLEProbDist based on %d samples>" % self._freqdist.N()
808
809
810class LidstoneProbDist(ProbDistI):

Callers 4

refineMethod · 0.90
train_supervisedMethod · 0.90
_create_sum_pdistFunction · 0.85
demoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…