Package edu.cmu.tetrad.bayes
Class StoredCellProbsObs
java.lang.Object
edu.cmu.tetrad.bayes.StoredCellProbsObs
- All Implemented Interfaces:
TetradSerializable
,Serializable
Creates a table of stored cell probabilities for the given list of variables. Since for a moderate number of variables and for a moderate number of values per variables this could get to be a very large table, it might not be a good idea to use this class except for unit testing.> 0
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStoredCellProbsObs
(List<Node> variables) Constructor for StoredCellProbsObs. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearCellTable.void
createCellTable
(MlBayesIm bayesIm) createCellTable.void
createCellTable
(MlBayesImObs bayesIm) createCellTable.double
getCellProb
(int[] variableValues) getCellProb.double
getConditionalProb
(Proposition assertion, Proposition condition) Calculates the conditional probability of an assertion given a condition.int
getNumRows.double
getProb
(Proposition assertion) getProb.Getter for the fieldvariables
.int[]
getVariableValues
(int rowIndex) getVariableValues.static StoredCellProbsObs
Generates a simple exemplar of this class to test serialization.void
setCellProbability
(int[] variableValues, double probability) setCellProbability.toString()
toString.
-
Constructor Details
-
StoredCellProbsObs
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
StoredCellProbsObs
object
-
clearCellTable
public void clearCellTable()clearCellTable.
-
createCellTable
-
createCellTable
createCellTable.
- Parameters:
bayesIm
- aMlBayesImObs
object
-
getCellProb
public double getCellProb(int[] variableValues) getCellProb.
- Parameters:
variableValues
- an array of objects- Returns:
- the probability for the given cell, specified as a particular combination of variable values, for the list of variables (in order) returned by get
-
getProb
getProb.
- Parameters:
assertion
- aProposition
object- Returns:
- a double
-
getConditionalProb
Calculates the conditional probability of an assertion given a condition.- Parameters:
assertion
- The proposition representing the assertion.condition
- The proposition representing the condition.- Returns:
- The conditional probability of the assertion given the condition.
- Throws:
IllegalArgumentException
- If the assertion and condition are not for the same Bayes IM.
-
getVariables
-
getNumRows
public int getNumRows()getNumRows.
- Returns:
- a int
-
toString
-
getVariableValues
public int[] getVariableValues(int rowIndex) getVariableValues.
- Parameters:
rowIndex
- a int- Returns:
- an array of objects
-
setCellProbability
public void setCellProbability(int[] variableValues, double probability) setCellProbability.
- Parameters:
variableValues
- an array of objectsprobability
- a double
-