nltk :: probability :: MLEProbDist :: Class MLEProbDist
[hide private]
[frames] | no frames]

Class MLEProbDist

object --+    
         |    
 ProbDistI --+
             |
            MLEProbDist

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.

Instance Methods [hide private]
 
__init__(self, freqdist)
Use the maximum likelihood estimate to create a probability distribution for the experiment used to generate freqdist.
string
__repr__(self)
Returns: A string representation of this ProbDist.
FreqDist
freqdist(self)
Returns: The frequency distribution that this probability distribution is based on.
any
max(self)
Returns: the sample with the greatest probability.
float
prob(self, sample)
Returns: the probability for a given sample.
list
samples(self)
Returns: A list of all samples that have nonzero probabilities.

Inherited from ProbDistI: discount, generate, logprob

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

Class Variables [hide private]

Inherited from ProbDistI: SUM_TO_ONE

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, freqdist)
(Constructor)

 

Use the maximum likelihood estimate to create a probability distribution for the experiment used to generate freqdist.

Parameters:
  • freqdist (FreqDist) - The frequency distribution that the probability estimates should be based on.
Overrides: object.__init__

__repr__(self)
(Representation operator)

 

repr(x)

Returns: string
A string representation of this ProbDist.
Overrides: object.__repr__

freqdist(self)

 
Returns: FreqDist
The frequency distribution that this probability distribution is based on.

max(self)

 
Returns: any
the sample with the greatest probability. If two or more samples have the same probability, return one of them; which sample is returned is undefined.
Overrides: ProbDistI.max
(inherited documentation)

prob(self, sample)

 
Parameters:
  • sample - The sample whose probability should be returned.
Returns: float
the probability for a given sample. Probabilities are always real numbers in the range [0, 1].
Overrides: ProbDistI.prob
(inherited documentation)

samples(self)

 
Returns: list
A list of all samples that have nonzero probabilities. Use prob to find the probability of each sample.
Overrides: ProbDistI.samples
(inherited documentation)