Package edu.cmu.tetrad.bayes
Class StoredCellProbs
java.lang.Object
edu.cmu.tetrad.bayes.StoredCellProbs
- 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:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StoredCellProbs
createCellTable
(BayesIm bayesIm) createCellTable.static StoredCellProbs
createRandomCellTable
(List<Node> variables) createRandomCellTable.double
getCellProb
(int[] variableValues) getCellProb.double
getConditionalProb
(Proposition assertion, Proposition condition) Calculates the conditional probability of an assertion given a condition.double
getProb
(Proposition assertion) Calculates the probability for the given proposition assertion.Getter for the fieldvariables
.static StoredCellProbs
Generates a simple exemplar of this class to test serialization.toString()
toString.
-
Method Details
-
createRandomCellTable
createRandomCellTable.
- Parameters:
variables
- aList
object- Returns:
- a
StoredCellProbs
object
-
createCellTable
createCellTable.
- Parameters:
bayesIm
- aBayesIm
object- Returns:
- a
StoredCellProbs
object
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
StoredCellProbs
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
Calculates the probability for the given proposition assertion.- Parameters:
assertion
- The proposition assertion for which to calculate the probability.- Returns:
- The probability for the given proposition assertion.
-
getConditionalProb
Calculates the conditional probability of an assertion given a condition.- Parameters:
assertion
- the proposition assertion for which to calculate the probabilitycondition
- the proposition 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
-
toString
-