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 TypeMethodDescriptionvoidclearCellTable.voidcreateCellTable(MlBayesIm bayesIm) createCellTable.voidcreateCellTable(MlBayesImObs bayesIm) createCellTable.doublegetCellProb(int[] variableValues) getCellProb.doublegetConditionalProb(Proposition assertion, Proposition condition) Calculates the conditional probability of an assertion given a condition.intgetNumRows.doublegetProb(Proposition assertion) getProb.Getter for the fieldvariables.int[]getVariableValues(int rowIndex) getVariableValues.static StoredCellProbsObsGenerates a simple exemplar of this class to test serialization.voidsetCellProbability(int[] variableValues, double probability) setCellProbability.toString()toString.
-
Constructor Details
-
StoredCellProbsObs
Constructor for StoredCellProbsObs.
- Parameters:
variables- aListobject
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
StoredCellProbsObsobject
-
clearCellTable
public void clearCellTable()clearCellTable.
-
createCellTable
createCellTable.
- Parameters:
bayesIm- aMlBayesImobject
-
createCellTable
createCellTable.
- Parameters:
bayesIm- aMlBayesImObsobject
-
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- aPropositionobject- 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
Getter for the field
variables.- Returns:
- a
Listobject
-
getNumRows
public int getNumRows()getNumRows.
- Returns:
- a int
-
toString
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
-