Module dist :: Class MixtureDist
[frames] | no frames]

Class MixtureDist

A mixture of two probabability distributions, d1 and d2, with mixture parameter p. Probability of an element x under this distribution is p * d1(x) + (1 - p) * d2(x). It is as if we first flip a probability-p coin to decide which distribution to draw from, and then choose from the approriate distribution.

This implementation is lazy; it stores the component distributions. Alternatively, we could assume that d1 and d2 are DDists and compute a new DDist.

Instance Methods
 
__init__(self, d1, d2, p)
 
prob(self, elt)
 
draw(self)
 
support(self)
 
__str__(self)
 
__repr__(self)