techniques.BN
Class ProbTable

java.lang.Object
  |
  +--techniques.BN.ProbTable

public class ProbTable
extends Object

Represents a probability table, and can be thought of as a maintainer of functions of discrete types.


Field Summary
 double[] table
           
 
Constructor Summary
ProbTable(Variable var)
           
ProbTable(Variable[] var)
           
 
Method Summary
 String getCompleteString()
          Returns string of variables and data in table
 int getNumVariables()
           
 double getProb(int[] evidence)
          Same as getProb(Map) with evidence instead provided as an int array.
 double getProb(Map evidence)
          Used to get the probability values for the given variable evidence.
 String getTableAsString()
           
 int getTableSize()
          Returns size of the underlying table.
static int getTableSize(Variable[] var)
          Returns size of the table that would be formed from the given variables
 Variable getVariable(int i)
           
 Variable[] getVariables()
           
 Iterator getVariablesIterator()
          Returns an iterator through a set of all entries (variable-value combinations for the variables) in the table.
 String getVarString()
          Returns string of variables in table
 void setProb(int[] evidence, double prob)
           
 void setProb(Map evidence, double prob)
          All values for variables in the table are needed to be in the map for successful completion of the method
 void setTableValue(HashMap knownValues, double inTableValue)
          Sets the probability table value given all the values for the parents of the current prob.
 void setTableValue(int[] evidence, double inTableValue)
          Sets the probability table value given all the values for the parents of the current prob.
 void setTableValues(HashMap knownValues, double[] inTableValues)
          Sets the probability tables values given the first few variable values for the current prob.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

table

public double[] table
Constructor Detail

ProbTable

public ProbTable(Variable var)

ProbTable

public ProbTable(Variable[] var)
Method Detail

getTableSize

public int getTableSize()
Returns size of the underlying table.

getTableSize

public static int getTableSize(Variable[] var)
Returns size of the table that would be formed from the given variables

setTableValue

public void setTableValue(HashMap knownValues,
                          double inTableValue)
Sets the probability table value given all the values for the parents of the current prob. table. This method is identical to setProb

setTableValue

public void setTableValue(int[] evidence,
                          double inTableValue)
Sets the probability table value given all the values for the parents of the current prob. table.

setTableValues

public void setTableValues(HashMap knownValues,
                           double[] inTableValues)
Sets the probability tables values given the first few variable values for the current prob. table.

getProb

public double getProb(Map evidence)
Used to get the probability values for the given variable evidence. All values (as given by indices) in the table (for the variable and parents), need to be specified in the evidence (otherwise a not enough evidence exception will be thrown).

setProb

public void setProb(Map evidence,
                    double prob)
All values for variables in the table are needed to be in the map for successful completion of the method

getProb

public double getProb(int[] evidence)
Same as getProb(Map) with evidence instead provided as an int array.
Parameters:
evidence - - evidence in the same order as the variables

setProb

public void setProb(int[] evidence,
                    double prob)
Parameters:
evidence - - evidence in the same order as the variables

getVariables

public Variable[] getVariables()

getVariable

public Variable getVariable(int i)

getNumVariables

public int getNumVariables()

getVarString

public String getVarString()
Returns string of variables in table

toString

public String toString()
Overrides:
toString in class Object

getTableAsString

public String getTableAsString()

getCompleteString

public String getCompleteString()
Returns string of variables and data in table

getVariablesIterator

public Iterator getVariablesIterator()
Returns an iterator through a set of all entries (variable-value combinations for the variables) in the table. The entries are represented by maps of the variables to their values (actually indexes of the values).