[frames] | no frames]

# Class DDist

Discrete distribution represented as a dictionary. Can be sparse, in the sense that elements that are not explicitly contained in the dictionary are assumed to have zero probability.

Instance Methods

 __init__(self, dictionary)

 dictCopy(self) Returns: A copy of the dictionary for this distribution.

 prob(self, elt) Returns: the probability associated with `elt`

 support(self) Returns: A list (in arbitrary order) of the elements of this distribution with non-zero probabability.

 __repr__(self)

 __str__(self)

 draw(self) Returns: a randomly drawn element from the distribution

 maxProbElt(self) Returns: The element in this domain with maximum probability

 marginalizeOut(self, index) Returns: DDist on all the rest of the variables

 conditionOnVar(self, index, value) Returns: new distribution, conditioned on variable `i` having value `value`, and with variable `i` removed from all of the elements (it's redundant at this point).
 Instance Variables d Dictionary whose keys are elements of the domain and values are their probabilities.
 Method Details

### dictCopy(self)

Returns:
A copy of the dictionary for this distribution.

### prob(self, elt)

Parameters:
• `elt` - an element of the domain of this distribution (does not need to be explicitly represented in the dictionary; in fact, for any element not in the dictionary, we return probability 0 without error.)
Returns:
the probability associated with `elt`

### support(self)

Returns:
A list (in arbitrary order) of the elements of this distribution with non-zero probabability.

### draw(self)

Returns:
a randomly drawn element from the distribution

### maxProbElt(self)

Returns:
The element in this domain with maximum probability

### marginalizeOut(self, index)

Parameters:
• `index` - index of a random variable to sum out of the distribution
Returns:
DDist on all the rest of the variables

### conditionOnVar(self, index, value)

Parameters:
• `index` - index of a variable in the joint distribution
• `value` - value of that variable
Returns:
new distribution, conditioned on variable `i` having value `value`, and with variable `i` removed from all of the elements (it's redundant at this point).

 Generated by Epydoc 3.0.1 on Tue Apr 26 17:51:16 2011 http://epydoc.sourceforge.net