Package edu.cmu.tetrad.bayes
Class DataSetProbs
java.lang.Object
edu.cmu.tetrad.bayes.DataSetProbs
Estimates maximum likelihood probabilities directly from data on the fly.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionDataSetProbs
(DataSet dataSet) 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 the given assertion being true, given the condition, in the dataset.Getter for the fielddataSet
.double
getProb
(Proposition assertion) Calculates the probability of the given assertion being true in the dataset.getVariables.
-
Constructor Details
-
DataSetProbs
Creates a cell count table for the given data set.- Parameters:
dataSet
- aDataSet
object
-
-
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 being true in the dataset.- Parameters:
assertion
- The proposition to be evaluated. It should be of typeProposition
.- Returns:
- The probability of the assertion being true as a double value.
-
getConditionalProb
Calculates the conditional probability of the given assertion being true, given the condition, in the dataset.- Parameters:
assertion
- a Proposition object representing the assertion.condition
- a Proposition object representing the condition.- Returns:
- the conditional probability of the assertion being true, given the condition, 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
getVariables.
- Returns:
- the list of variables for the dataset that this is estimating probabilities for.
-