Package nltk_lite :: Module probability :: Class LidstoneProbDist
[show private | hide private]
[frames | no frames]

Type LidstoneProbDist

object --+    
         |    
 ProbDistI --+
             |
            LidstoneProbDist

Known Subclasses:
ELEProbDist, LaplaceProbDist

The Lidstone estimate for the probability distribution of the experiment used to generate a frequency distribution. The Lidstone estimate is paramaterized by a real number gamma, which typically ranges from 0 to 1. The Lidstone estimate approximates the probability of a sample with count c from an experiment with N outcomes and B bins as (c+gamma)/(N+B*gamma). This is equivalant to adding gamma to the count for each bin, and taking the maximum likelihood estimate of the resulting frequency distribution.
Method Summary
  __init__(self, freqdist, gamma, bins)
Use the Lidstone estimate to create a probability distribution for the experiment used to generate freqdist.
string __repr__(self)
Return a string representation of this ProbDist.
FreqDist freqdist(self)
Return the frequency distribution that this probability distribution is based on.
any max(self)
Return the sample with the greatest probability.
float prob(self, sample)
Return the probability for a given sample.
list samples(self)
Return a list of all samples that have nonzero probabilities.
Inherited from ProbDistI: logprob
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Method Details

__init__(self, freqdist, gamma, bins=None)
(Constructor)

Use the Lidstone estimate to create a probability distribution for the experiment used to generate freqdist.
Parameters:
freqdist - The frequency distribution that the probability estimates should be based on.
           (type=FreqDist)
gamma - A real number used to paramaterize the estimate. The Lidstone estimate is equivalant to adding gamma to the count for each bin, and taking the maximum likelihood estimate of the resulting frequency distribution.
           (type=float)
bins - The number of sample values that can be generated by the experiment that is described by the probability distribution. This value must be correctly set for the probabilities of the sample values to sum to one. If bins is not specified, it defaults to freqdist.B().
           (type=int)
Overrides:
nltk_lite.probability.ProbDistI.__init__

__repr__(self)
(Representation operator)

Returns:
A string representation of this ProbDist.
           (type=string)
Overrides:
__builtin__.object.__repr__

freqdist(self)

Returns:
The frequency distribution that this probability distribution is based on.
           (type=FreqDist)

max(self)

Returns:
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.
           (type=any)
Overrides:
nltk_lite.probability.ProbDistI.max (inherited documentation)

prob(self, sample)

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

samples(self)

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

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net