|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.AbstractCondProbDistrib blog.distrib.TabularCPD
public class TabularCPD
CPD described by a table. The CPD can have any number of arguments, which are the parents. The parent types must be either Boolean, or user-defined types with some enumerated guaranteed objects and no number statements. The CPD defines a distribution over the enumerated objects (or true and false) of the child type, given any tuple of enumerated objects (or true/false) for the parents. The child type can also be Integer or NaturalNum, in which case the distribution is over some prefix of the natural numbers.
The CPD table has one row for each possible tuple of parent values (or just a single row if there are no parents). The rows are ordered according to a lexicographic ordering of tuples ("true" comes before "false", and enumerated objects come in the order they were declared). The parameters of the CPD should be a list of row vectors, each representing a row. Each row vector consists of real numbers, one per possible value of the child variable. Values of the child variable are ordered the same way as parent values.
It is also acceptable for a row to be shorter than the number of possible child values: then if the entries sum to less than 1, the remaining probability is allocated to the next child value (and any subsequent child values get probability 0). This means that for a Boolean child variable, the rows can have length one and just specify the probability of "true". If the probabilities in a row sum to more than 1, the TabularCPD constructor throws an IllegalArgumentException.
When one or more the parent values are Model.NULL
,
the child distribution is also concentrated on Model.NULL
.
When a TabularCPD object is created, it doesn't know the types of arguments or their domain sizes. But it computes and stores these things the first time the getProb or sampleVal method is called.
Constructor Summary | |
---|---|
TabularCPD(java.util.List params)
Creates a new tabular CPD with the given table rows. |
Method Summary | |
---|---|
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
. |
java.lang.String |
toString()
|
Methods inherited from class blog.AbstractCondProbDistrib |
---|
getLogProb |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TabularCPD(java.util.List params)
Method Detail |
---|
public double getProb(java.util.List args, java.lang.Object value)
CondProbDistrib
childValue
given the argument values args
.
For a continuous distribution, returns the conditional probability
density at childValue
.
public java.lang.Object sampleVal(java.util.List args, Type childType)
CondProbDistrib
args
. The object returned should be of the specified type.
public java.lang.String toString()
toString
in class AbstractCondProbDistrib
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |