public class BNNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
BNNode[] |
children
array of node children (possibly empty)
|
double[] |
cpt
conditional probability table indexed by the binary number formed by concatenating Boolean bits from parent values (ordered by parents array), that is:
parents[0].value?1:0 * 2^(p-1)
+ parents[1].value?1:0 * 2^(p-2)
+ ...
|
boolean |
isEvidence
whether or not node is an evidence node
|
java.lang.String |
name
node variable name
|
static java.util.ArrayList<BNNode> |
nodes
list of all BNNodes
|
BNNode[] |
parents
array of node parents (possibly empty)
|
boolean |
value
node variable value
|
Constructor and Description |
---|
BNNode() |
Modifier and Type | Method and Description |
---|---|
static void |
computeChildren()
Compute the children from the parents.
|
double |
cptLookup()
Returns Conditional Probability Table (CPT) entry (probability of current variable being true) corresponding to current parent node values.
|
static void |
printBN()
Print all information about the BN.
|
java.lang.String |
toString()
Return String representation of node.
|
public static java.util.ArrayList<BNNode> nodes
public java.lang.String name
public boolean value
public BNNode[] parents
public BNNode[] children
public double[] cpt
public boolean isEvidence
public static void computeChildren()
public double cptLookup()
Example: P(a|b,c) = {0.1, 0.2, 0.3, 0.4} means P(+a|-b -c) = 0.1 P(+a|-b +c) = 0.2 P(+a|+b -c) = 0.3 P(+a|+b +c) = 0.4 0 0 0 1 1 0 1 1 0 1 2 3 cpt == {0.1, 0.2, 0.3, 0.4}
public static void printBN()
public java.lang.String toString()
toString
in class java.lang.Object