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 (see). The reference is here:
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 using a covariance matrix. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the max degree, by default 1000.double
Returns the penalty discount for this score, which is a multiplier on the penalty term of the BIC score.int
Returns the sample size of the data.The variables of the score.boolean
isEffectEdge
(double bump) Returns true iff the edge between x and y is an effect edge.double
localScore
(int i, int... parents) Calculates the sample likelihood and BIC score for index i given its parents in a simple SEM model.double
localScoreDiff
(int x, int y, int[] z) Calculates localScore(y | z, x) - localScore(z).void
setNumCategoriesToDiscretize
(int numCategoriesToDiscretize) Sets tne number of categories used to discretize, when this optimization is used.void
setPenaltyDiscount
(double penaltyDiscount) Sets the penalty discount for this score, which is a multiplier on the penalty discount of the BIC score.void
setStructurePrior
(double structurePrior) Setter for the fieldstructurePrior
.toString()
A string representation of the score.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.search.score.Score
append, determines, getVariable, localScore, localScore, localScoreDiff
-
Constructor Details
-
ConditionalGaussianScore
Constructs the score using a covariance matrix.- Parameters:
dataSet
- A dataset with a mixture of continuous and discrete variables. It may be all continuous or all discrete.penaltyDiscount
- A multiplier on the penalty term in the BIC score.discretize
- When a discrete variable is a child of a continuous variable, one (expensive) way to solve the problem is to do a numerical integration. A less expensive (and often more accurate) way to solve the problem is to discretize the child with a certain number of discrete categories. if this parameter is set to True, a separate copy of all variables is maintained that is discretized in this way, and these are substituted for the discrete children when this sort of problem needs to be solved. This information needs to be known in the constructor since one needs to know right away whether ot create this separate discretized version of the continuous columns.- See Also:
-
-
Method Details
-
localScore
public double localScore(int i, int... parents) Calculates the sample likelihood and BIC score for index i given its parents in a simple SEM model.- Specified by:
localScore
in interfaceScore
- Parameters:
i
- The index of the child.parents
- The indices of the parents.- Returns:
- The score.,
-
localScoreDiff
public double localScoreDiff(int x, int y, int[] z) Calculates localScore(y | z, x) - localScore(z).- Specified by:
localScoreDiff
in interfaceScore
- Parameters:
x
- The index of the child.y
- a intz
- The indices of the parents.- Returns:
- The score difference.
-
getSampleSize
public int getSampleSize()Returns the sample size of the data.- Specified by:
getSampleSize
in interfaceScore
- Returns:
- This size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Returns true iff the edge between x and y is an effect edge.A method for FGES for determining whether an edge counts as an effect edges for this score bump.
- Specified by:
isEffectEdge
in interfaceScore
- Parameters:
bump
- The bump.- Returns:
- True iff the edge between x and y is an effect edge.
- See Also:
-
getVariables
The variables of the score.Returns the variables of the data.
- Specified by:
getVariables
in interfaceScore
- Returns:
- This list.
-
getMaxDegree
public int getMaxDegree()Returns the max degree, by default 1000.Returns the max degree recommended for the search form the MagSemBicScore and Fges.
- Specified by:
getMaxDegree
in interfaceScore
- Returns:
- The max degree.
- See Also:
-
getPenaltyDiscount
public double getPenaltyDiscount()Returns the penalty discount for this score, which is a multiplier on the penalty term of the BIC score.- Returns:
- This penalty discount.
-
setPenaltyDiscount
public void setPenaltyDiscount(double penaltyDiscount) Sets the penalty discount for this score, which is a multiplier on the penalty discount of the BIC score.- Parameters:
penaltyDiscount
- This penalty discount.
-
setNumCategoriesToDiscretize
public void setNumCategoriesToDiscretize(int numCategoriesToDiscretize) Sets tne number of categories used to discretize, when this optimization is used.- Parameters:
numCategoriesToDiscretize
- This number.
-
toString
-
setStructurePrior
public void setStructurePrior(double structurePrior) Setter for the field
structurePrior
.- Parameters:
structurePrior
- a double
-