nltk.probability.ELEProbDist¶
- class nltk.probability.ELEProbDist[source]¶
Bases:
LidstoneProbDist
The expected likelihood estimate for the probability distribution of the experiment used to generate a frequency distribution. The “expected likelihood estimate” approximates the probability of a sample with count c from an experiment with N outcomes and B bins as (c+0.5)/(N+B/2). This is equivalent to adding 0.5 to the count for each bin, and taking the maximum likelihood estimate of the resulting frequency distribution.
- __init__(freqdist, bins=None)[source]¶
Use the expected 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.
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 tofreqdist.B()
.
- SUM_TO_ONE = False¶
True if the probabilities of the samples in this probability distribution will always sum to one.
- discount()[source]¶
Return the ratio by which counts are discounted on average: c*/c
- Return type
float
- freqdist()[source]¶
Return the frequency distribution that this probability distribution is based on.
- Return type
- generate()[source]¶
Return a randomly selected sample from this probability distribution. The probability of returning each sample
samp
is equal toself.prob(samp)
.
- logprob(sample)[source]¶
Return the base 2 logarithm of the probability for a given sample.
- Parameters
sample (any) – The sample whose probability should be returned.
- Return type
float
- max()[source]¶
Return 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.
- Return type
any