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

Type UniformProbDist

object --+    
         |    
 ProbDistI --+
             |
            UniformProbDist


A probability distribution that assigns equal probability to each sample in a given set; and a zero probability to all other samples.
Method Summary
  __init__(self, samples)
Construct a new uniform probability distribution, that assigns equal probability to each sample in samples.
  __repr__(self)
any max(self)
Return the sample with the greatest probability.
float prob(self, sample)
Return the probability for a given sample.
list samples(self)
Return a list of all samples that have nonzero probabilities.
Inherited from ProbDistI: logprob
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Method Details

__init__(self, samples)
(Constructor)

Construct a new uniform probability distribution, that assigns equal probability to each sample in samples.
Parameters:
samples - The samples that should be given uniform probability.
           (type=list)
Raises:
ValueError - If samples is empty.
Overrides:
nltk_lite.probability.ProbDistI.__init__

max(self)

Returns:
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.
           (type=any)
Overrides:
nltk_lite.probability.ProbDistI.max (inherited documentation)

prob(self, sample)

Parameters:
sample - The sample whose probability should be returned.
           (type=any)
Returns:
the probability for a given sample. Probabilities are always real numbers in the range [0, 1].
           (type=float)
Overrides:
nltk_lite.probability.ProbDistI.prob (inherited documentation)

samples(self)

Returns:
A list of all samples that have nonzero probabilities. Use prob to find the probability of each sample.
           (type=list)
Overrides:
nltk_lite.probability.ProbDistI.samples (inherited documentation)

Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 http://epydoc.sf.net