class documentation

class RandomProbDist(ProbDistI): (source)

Constructor: RandomProbDist(samples)

View In Hierarchy

Generates a random probability distribution whereby each sample will be between 0 and 1 with equal probability (uniform random distribution. Also called a continuous uniform distribution).

Class Method unirand The key function that creates a randomized initial distribution that still sums to 1. Set as a dictionary of prob values so that it can still be passed to MutableProbDist and called with identical syntax to UniformProbDist...
Method __init__ Classes inheriting from ProbDistI should implement __init__.
Method __repr__ Undocumented
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.
Instance Variable _max Undocumented
Instance Variable _probs Undocumented
Instance Variable _samples Undocumented

Inherited from ProbDistI:

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.
Constant SUM_TO_ONE True if the probabilities of the samples in this probability distribution will always sum to one.
@classmethod
def unirand(cls, samples): (source)

The key function that creates a randomized initial distribution that still sums to 1. Set as a dictionary of prob values so that it can still be passed to MutableProbDist and called with identical syntax to UniformProbDist

def __init__(self, samples): (source)

Classes inheriting from ProbDistI should implement __init__.

def __repr__(self): (source)

Undocumented

def max(self): (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.

Returns
anyUndocumented
def prob(self, sample): (source)

Return the probability for a given sample. Probabilities are always real numbers in the range [0, 1].

Parameters
sample:anyThe sample whose probability should be returned.
Returns
floatUndocumented
def samples(self): (source)

Return a list of all samples that have nonzero probabilities. Use prob to find the probability of each sample.

Returns
listUndocumented

Undocumented

Undocumented

_samples = (source)

Undocumented