Package nltk :: Module probability :: Class LaplaceProbDist
[hide private]
[frames] | no frames]

Class LaplaceProbDist

source code

  object --+        
           |        
   ProbDistI --+    
               |    
LidstoneProbDist --+
                   |
                  LaplaceProbDist

The Laplace estimate for the probability distribution of the experiment used to generate a frequency distribution. The Lidstone estimate approximates the probability of a sample with count c from an experiment with N outcomes and B bins as (c+1)/(N+B). This is equivalant to adding one to the count for each bin, and taking the maximum likelihood estimate of the resulting frequency distribution.

Instance Methods [hide private]
 
__init__(self, freqdist, bins=None)
Use the Laplace estimate to create a probability distribution for the experiment used to generate freqdist.
source code
string
__repr__(self)
Returns: A string representation of this ProbDist.
source code

Inherited from LidstoneProbDist: discount, freqdist, max, prob, samples

Inherited from ProbDistI: generate, logprob

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

Class Variables [hide private]

Inherited from LidstoneProbDist: SUM_TO_ONE

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

Use the Laplace 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.
  • bins (int) - 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().
Overrides: LidstoneProbDist.__init__

__repr__(self)
(Representation operator)

source code 
Returns: string
A string representation of this ProbDist.
Overrides: LidstoneProbDist.__repr__