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.Getter for the fielddataSet
.double
getProb
(Proposition assertion) Calculates the probability of the given assertion.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
Creates a cell count table for the given data set.- Parameters:
dataSet
- aDataSet
objectsymmValue
- a double
-
-
Method Details
-
getCellProb
public double getCellProb(int[] variableValues) getCellProb.
- Parameters:
variableValues
- an array ofinvalid reference
int
- Returns:
- the estimated probability for the given cell. The order of the variable values is the order of the variables in getVariable().
-
getProb
Calculates the probability of the given assertion.- Parameters:
assertion
- the proposition representing the assertion.- Returns:
- the probability of the assertion.
-
getConditionalProb
Calculates the conditional probability of an assertion given a condition.- Parameters:
assertion
- a proposition representing the assertioncondition
- a 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 IMIllegalArgumentException
- 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
getVariables.
- Returns:
- the list of variables for the dataset that this is estimating probabilities for.
-
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
-