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

Class CrossValidationProbDist

source code

object --+    
         |    
 ProbDistI --+
             |
            CrossValidationProbDist

The cross-validation estimate for the probability distribution of the experiment used to generate a set of frequency distribution. The cross-validation estimate for the probability of a sample is found by averaging the held-out estimates for the sample in each pair of frequency distributions.

Instance Methods [hide private]
 
__init__(self, freqdists, bins)
Use the cross-validation estimate to create a probability distribution for the experiment used to generate freqdists.
source code
list of FreqDist
freqdists(self)
Returns: The list of frequency distributions that this ProbDist is based on.
source code
float
prob(self, sample)
Returns: the probability for a given sample.
source code
string
__repr__(self)
Returns: A string representation of this ProbDist.
source code

Inherited from ProbDistI: logprob, max, samples

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, freqdists, bins)
(Constructor)

source code 

Use the cross-validation estimate to create a probability distribution for the experiment used to generate freqdists.

Parameters:
  • freqdists (list of FreqDist) - A list of the frequency distributions generated by the experiment.
  • 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: ProbDistI.__init__

freqdists(self)

source code 
Returns: list of FreqDist
The list of frequency distributions that this ProbDist is based on.

prob(self, sample)

source code 
Returns: float
the probability for a given sample. Probabilities are always real numbers in the range [0, 1].
Overrides: ProbDistI.prob
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

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