class ProbDistI: (source)
Known subclasses: nltk.probability.CrossValidationProbDist, nltk.probability.DictionaryProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.MLEProbDist, nltk.probability.MutableProbDist, nltk.probability.RandomProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.UniformProbDist, nltk.probability.WittenBellProbDist
Constructor: ProbDistI()
A probability distribution for the outcomes of an experiment. A probability distribution specifies how likely it is that an experiment will have any given outcome. For example, a probability distribution could be used to predict the probability that a token in a document will have a given type. Formally, a probability distribution can be defined as a function mapping from samples to nonnegative real numbers, such that the sum of every number in the function's range is 1.0. A ProbDist is often used to model the probability distribution of the experiment used to generate a frequency distribution.
| Method | __init__ |
Classes inheriting from ProbDistI should implement __init__. |
| Method | discount |
Return the ratio by which counts are discounted on average: c*/c |
| Method | generate |
Return a randomly selected sample from this probability distribution. The probability of returning each sample samp is equal to self.prob(samp). |
| Method | logprob |
Return the base 2 logarithm of the probability for a given sample. |
| Method | max |
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. |
| Method | prob |
Return the probability for a given sample. Probabilities are always real numbers in the range [0, 1]. |
| Method | samples |
Return a list of all samples that have nonzero probabilities. Use prob to find the probability of each sample. |
| Constant | SUM |
True if the probabilities of the samples in this probability distribution will always sum to one. |
nltk.probability.CrossValidationProbDist, nltk.probability.DictionaryProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.MLEProbDist, nltk.probability.MutableProbDist, nltk.probability.RandomProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.UniformProbDist, nltk.probability.WittenBellProbDistClasses inheriting from ProbDistI should implement __init__.
nltk.probability.CrossValidationProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.WittenBellProbDistReturn the ratio by which counts are discounted on average: c*/c
| Returns | |
| float | Undocumented |
Return a randomly selected sample from this probability distribution. The probability of returning each sample samp is equal to self.prob(samp).
Return the base 2 logarithm of the probability for a given sample.
| Parameters | |
| sample:any | The sample whose probability should be returned. |
| Returns | |
| float | Undocumented |
nltk.probability.DictionaryProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.MLEProbDist, nltk.probability.MutableProbDist, nltk.probability.RandomProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.UniformProbDist, nltk.probability.WittenBellProbDistReturn 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.
| Returns | |
| any | Undocumented |
nltk.probability.CrossValidationProbDist, nltk.probability.DictionaryProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.MLEProbDist, nltk.probability.MutableProbDist, nltk.probability.RandomProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.UniformProbDist, nltk.probability.WittenBellProbDistReturn the probability for a given sample. Probabilities are always real numbers in the range [0, 1].
| Parameters | |
| sample:any | The sample whose probability should be returned. |
| Returns | |
| float | Undocumented |
nltk.probability.CrossValidationProbDist, nltk.probability.DictionaryProbDist, nltk.probability.HeldoutProbDist, nltk.probability.KneserNeyProbDist, nltk.probability.LidstoneProbDist, nltk.probability.MLEProbDist, nltk.probability.MutableProbDist, nltk.probability.RandomProbDist, nltk.probability.SimpleGoodTuringProbDist, nltk.probability.UniformProbDist, nltk.probability.WittenBellProbDistReturn a list of all samples that have nonzero probabilities. Use prob to find the probability of each sample.
| Returns | |
| list | Undocumented |
nltk.probability.CrossValidationProbDist, nltk.probability.HeldoutProbDist, nltk.probability.LidstoneProbDist, nltk.probability.SimpleGoodTuringProbDistTrue if the probabilities of the samples in this probability distribution will always sum to one.
| Value |
|