Package edu.cmu.tetrad.bayes
Class DirichletDataSetProbs
java.lang.Object
edu.cmu.tetrad.bayes.DirichletDataSetProbs
Estimates probabilities directly from data on the fly using maximum likelihood method.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionDirichletDataSetProbs
(DataSet dataSet, double symmValue) Creates a cell count table for the given data set. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getCellProb
(int[] variableValues) getCellProb.double
getConditionalProb
(Proposition assertion, Proposition condition) Calculates the conditional probability of an assertion given a condition in the context of a Bayes IM.Getter for the fielddataSet
.double
getProb
(Proposition assertion) Retrieves the probability of the given assertion in the DirichletDataSetProbs.getVariables.boolean
True iff bounds checking is performed on variable values indices.void
setBoundsEnforced
(boolean boundsEnforced) True iff bounds checking is performed on variable values indices.
-
Constructor Details
-
DirichletDataSetProbs
-
-
Method Details
-
getCellProb
public double getCellProb(int[] variableValues) getCellProb.
- Parameters:
variableValues
- an array of objects- Returns:
- the estimated probability for the given cell. The order of the variable values is the order of the variables in getVariable().
-
getProb
Retrieves the probability of the given assertion in the DirichletDataSetProbs.- Parameters:
assertion
- The proposition to be checked for probability.- Returns:
- The probability of the assertion as a double value.
-
getConditionalProb
Calculates the conditional probability of an assertion given a condition in the context of a Bayes IM.- Parameters:
assertion
- the proposition representing the assertioncondition
- the proposition representing the condition- Returns:
- the conditional probability as a double value
- Throws:
IllegalArgumentException
- if the assertion and condition are not for the same Bayes IM or if the assertion variable and data variables are different or in a different order
-
getDataSet
Getter for the field
dataSet
.- Returns:
- the dataset that this is estimating probabilities for.
-
getVariables
-
isBoundsEnforced
public boolean isBoundsEnforced()True iff bounds checking is performed on variable values indices.- Returns:
- a boolean
-
setBoundsEnforced
public void setBoundsEnforced(boolean boundsEnforced) True iff bounds checking is performed on variable values indices.- Parameters:
boundsEnforced
- a boolean
-