Package edu.cmu.tetrad.search.score
Class ConditionalGaussianScore
java.lang.Object
edu.cmu.tetrad.search.score.ConditionalGaussianScore
- All Implemented Interfaces:
Score
Implements a conditional Gaussian BIC score for FGS, which calculates a BIC score for mixed discrete/Gaussian data
using the conditional Gaussian likelihood function.
Reference: Andrews, B., Ramsey, J., & Cooper, G. F. (2018). Scoring Bayesian networks of mixed variables. International Journal of Data Science and Analytics, 6, 3–18.
As for all scores in Tetrad, higher scores mean more dependence, and negative scores indicate independence.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConditionalGaussianScore(DataSet dataSet, double penaltyDiscount, boolean discretize) Constructs the score. -
Method Summary
Modifier and TypeMethodDescriptionintRecommended max degree (same heuristic used elsewhere).doubleRetrieves the penalty discount value used in the scoring calculations.intSample size.Returns the list of variables.booleanisEffectEdge(double bump) FGES “effect edge” convention for this score bump.doublelocalScore(int i, int... parents) Local BIC score for child i with parents.doublelocalScoreDiff(int x, int y, int[] z) Score difference localScore(y | z ∪ {x}) - localScore(y | z).voidsetDiscretize(boolean discretize) Sets whether to discretize child variables for shadow discretization.voidsetMinSampleSizePerCell(int n) Sets the minimum sample size per cell for scoring calculations during the learning process.voidsetNumCategoriesToDiscretize(int numCategoriesToDiscretize) Sets the number of categories to be used for discretizing child variables in order to avoid integration.voidsetPenaltyDiscount(double penaltyDiscount) Updates the penalty discount value used in the scoring calculations.voidsetStructurePrior(double structurePrior) Sets the structure prior value for the scoring process.toString()Returns a string representation of the Conditional Gaussian Score Penalty.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.score.Score
append, determines, getVariable, localScore, localScore, localScoreDiff
-
Constructor Details
-
ConditionalGaussianScore
Constructs the score.- Parameters:
dataSet- mixed (or all-continuous / all-discrete) datasetpenaltyDiscount- BIC penalty multiplierdiscretize- if true, use shadow discretization of continuous parents for discrete children
-
-
Method Details
-
localScore
public double localScore(int i, int... parents) Local BIC score for child i with parents.- Specified by:
localScorein interfaceScore- Parameters:
i- child indexparents- parent indices- Returns:
- local BIC score for child i with parents
-
localScoreDiff
public double localScoreDiff(int x, int y, int[] z) Score difference localScore(y | z ∪ {x}) - localScore(y | z).- Specified by:
localScoreDiffin interfaceScore- Parameters:
x- index of the variable to add to the parentsy- index of the child variablez- array of parent indices- Returns:
- score difference
-
getSampleSize
public int getSampleSize()Sample size.- Specified by:
getSampleSizein interfaceScore- Returns:
- sample size
-
isEffectEdge
public boolean isEffectEdge(double bump) FGES “effect edge” convention for this score bump.- Specified by:
isEffectEdgein interfaceScore- Parameters:
bump- score bump- Returns:
- true if the score bump is positive, false otherwise
-
getVariables
Returns the list of variables.- Specified by:
getVariablesin interfaceScore- Returns:
- list of variables
-
getMaxDegree
public int getMaxDegree()Recommended max degree (same heuristic used elsewhere).- Specified by:
getMaxDegreein interfaceScore- Returns:
- the max degree.
-
getPenaltyDiscount
public double getPenaltyDiscount()Retrieves the penalty discount value used in the scoring calculations.- Returns:
- the penalty discount value as a double.
-
setPenaltyDiscount
public void setPenaltyDiscount(double penaltyDiscount) Updates the penalty discount value used in the scoring calculations.- Parameters:
penaltyDiscount- the new penalty discount value as a double
-
setNumCategoriesToDiscretize
public void setNumCategoriesToDiscretize(int numCategoriesToDiscretize) Sets the number of categories to be used for discretizing child variables in order to avoid integration.- Parameters:
numCategoriesToDiscretize- the number of categories to discretize child variables
-
setDiscretize
public void setDiscretize(boolean discretize) Sets whether to discretize child variables for shadow discretization. This affects scoring during the learning process to optimize calculations involving mixed data types.- Parameters:
discretize- A boolean value indicating whether to enable discretization. If true, enables discretization.
-
setMinSampleSizePerCell
public void setMinSampleSizePerCell(int n) Sets the minimum sample size per cell for scoring calculations during the learning process.- Parameters:
n- The minimum number of samples required per cell to guarantee stable computations.
-
setStructurePrior
public void setStructurePrior(double structurePrior) Sets the structure prior value for the scoring process.- Parameters:
structurePrior- The value of the structure prior to be used in scoring calculations.
-
toString
Returns a string representation of the Conditional Gaussian Score Penalty. The representation includes the penalty discount formatted to two decimal places.
-