Package nltk :: 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
list
samples(self)
Returns: A list of all samples that have nonzero probabilities.
source code
float
prob(self, sample)
Returns: the probability for a given sample.
source code
float
discount(self)
Returns: The ratio by which counts are discounted on average: c*/c
source code
string
__repr__(self)
Returns: A string representation of this ProbDist.
source code

Inherited from ProbDistI: generate, logprob, max

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

Class Variables [hide private]
  SUM_TO_ONE = False
True if the probabilities of the samples in this probability distribution will always sum to one.
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.

samples(self)

source code 
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)

prob(self, sample)

source code 
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)

discount(self)

source code 
Returns: float
The ratio by which counts are discounted on average: c*/c
Overrides: ProbDistI.discount
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

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