blog.distrib
Class MixtureDistrib

java.lang.Object
  extended by blog.AbstractCondProbDistrib
      extended by blog.distrib.MixtureDistrib
All Implemented Interfaces:
CondProbDistrib

public class MixtureDistrib
extends AbstractCondProbDistrib

A mixture of conditional probability distributions. The distributions being mixed together can have arguments, but the mixing probabilities cannot depend on the arguments. Currently this class does not have the standard constructor taking a list of parameters.


Constructor Summary
MixtureDistrib(CondProbDistrib[] distribs, double[] probs)
          Creates a new MixtureDistrib that combines the given distributions according to the given probabilities.
 
Method Summary
 double getLogProb(java.util.List args, java.lang.Object value)
          Returns the natural log of the value returned by getProb.
 double getProb(java.util.List args, java.lang.Object value)
          For a discrete distribution, returns the conditional probability of childValue given the argument values args.
 java.lang.Object sampleVal(java.util.List args, Type childType)
          Samples a value according to this CPD given the args .
 
Methods inherited from class blog.AbstractCondProbDistrib
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MixtureDistrib

public MixtureDistrib(CondProbDistrib[] distribs,
                      double[] probs)
Creates a new MixtureDistrib that combines the given distributions according to the given probabilities. The arrays of distributions and probabilities must have the same length.

Method Detail

getProb

public double getProb(java.util.List args,
                      java.lang.Object value)
Description copied from interface: CondProbDistrib
For a discrete distribution, returns the conditional probability of childValue given the argument values args. For a continuous distribution, returns the conditional probability density at childValue.


getLogProb

public double getLogProb(java.util.List args,
                         java.lang.Object value)
Description copied from interface: CondProbDistrib
Returns the natural log of the value returned by getProb.

Specified by:
getLogProb in interface CondProbDistrib
Overrides:
getLogProb in class AbstractCondProbDistrib

sampleVal

public java.lang.Object sampleVal(java.util.List args,
                                  Type childType)
Description copied from interface: CondProbDistrib
Samples a value according to this CPD given the args . The object returned should be of the specified type.