Class SemBicScore
- All Implemented Interfaces:
- Score
For FGES, Chickering uses the standard linear, Gaussian BIC score, so we will for lack of a better reference give his paper:
Chickering (2002) "Optimal structure identification with greedy search" Journal of Machine Learning Research.
The version of the score due to Nandy et al. is given in this reference:
Nandy, P., Hauser, A., & Maathuis, M. H. (2018). High-dimensional consistency in score-based and hybrid structure learning. The Annals of Statistics, 46(6A), 3151-3183.
This score may be used anywhere though where a linear, Gaussian score is needed. Anecdotally, the score is fairly robust to non-Gaussianity, though with some additional unfaithfulness over and above what the score would give for Gaussian data, a detriment that can be overcome to an extent by use a permutation algorithm such as SP, GRaSP, or BOSS.
As for all scores in Tetrad, higher scores mean more dependence, and negative scores indicate independence.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a covariance matrix and regression coefficients.static enumGives two options for calculating the BIC score, one describe by Chickering and the other due to Nandy et al.
- 
Constructor SummaryConstructorsConstructorDescriptionSemBicScore(DataSet dataSet, boolean precomputeCovariances) Constructs the score using a covariance matrix.SemBicScore(ICovarianceMatrix covariances) Constructs the score using a covariance matrix.
- 
Method SummaryModifier and TypeMethodDescriptionbooleandetermines(List<Node> z, Node y) Returns true iff the score determines the edge between x and y.static SemBicScore.CovAndCoefsgetCovAndCoefs(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean calculateRowSubsets, boolean usePseudoInverse) Returns the covariance matrix of the regression of the ith variable on its parents and the regression coefficients.static @NotNull SemBicScore.CovAndCoefsgetCovAndCoefs(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean usePseudoInverse, List<Integer> rows) Returns the covariance matrix of the regression of the ith variable on its parents and the regressionReturns the covariance matrix.getData()Returns the data model.Returns the data model.intReturns the max degree, by default 1000.doubleReturns the multiplier on the penalty term for this score.intReturns the sample size.doubleReturns the structure prior for this score.The variables of the score.static doublegetVarRy(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean calculateRowSubsets, boolean usePseudoInverse) Returns the variance of the residual of the regression of the ith variable on its parents.booleanisEffectEdge(double bump) Returns true iff the edge between x and y is an effect edge.booleanReturns true if verbose output should be sent to out.doublelocalScore(int i, int... parents) Returns the score for the given node and its parents.doublelocalScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.doublenandyBic(int x, int y, int[] z) nandyBic.voidsetPenaltyDiscount(double penaltyDiscount) Sets the multiplier on the penalty term for this score.voidsetRuleType(SemBicScore.RuleType ruleType) Sets the rule type to use.voidsetStructurePrior(double structurePrior) Sets the structure prior for this score.voidsetUsePseudoInverse(boolean usePseudoInverse) Returns the covariance matrix of the regression of the ith variable on its parents and the regression coefficients.voidsetVariables(List<Node> variables) Sets the variables of the covariance matrix.voidsetVerbose(boolean verbose) Sets whether verbose output should be sent to out.Returns a SEM BIC score for the given subset of variables.toString()Returns a string representation of this score.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.score.Scoreappend, getVariable, localScore, localScore, localScoreDiff
- 
Constructor Details- 
SemBicScoreConstructs the score using a covariance matrix.- Parameters:
- covariances- The covariance matrix.
 
- 
SemBicScoreConstructs the score using a covariance matrix.- Parameters:
- dataSet- The dataset.
- precomputeCovariances- Whether the covariances should be precomputed or computed on the fly. True if
 
 
- 
- 
Method Details- 
getVarRypublic static double getVarRy(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean calculateRowSubsets, boolean usePseudoInverse) throws org.apache.commons.math3.linear.SingularMatrixException Returns the variance of the residual of the regression of the ith variable on its parents.- Parameters:
- i- The index of the variable.
- parents- The indices of the parents.
- covariances- The covariance matrix.
- calculateRowSubsets- True if row subsets should be calculated.
- data- a- Matrixobject
- usePseudoInverse- a boolean
- Returns:
- The variance of the residual of the regression of the ith variable on its parents.
- Throws:
- org.apache.commons.math3.linear.SingularMatrixException- if any.
 
- 
getCovAndCoefs@NotNull public static SemBicScore.CovAndCoefs getCovAndCoefs(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean calculateRowSubsets, boolean usePseudoInverse) Returns the covariance matrix of the regression of the ith variable on its parents and the regression coefficients.- Parameters:
- i- The index of the variable.
- parents- The indices of the parents.
- data- The data matrix.
- covariances- The covariance matrix.
- calculateRowSubsets- True if row subsets should be calculated.
- usePseudoInverse- True if the pseudo-inverse should be used instead of the inverse to avoid exceptions.
- Returns:
- The covariance matrix of the regression of the ith variable on its parents and the regression coefficients.
 
- 
getCovAndCoefs@NotNull public static @NotNull SemBicScore.CovAndCoefs getCovAndCoefs(int i, int[] parents, Matrix data, ICovarianceMatrix covariances, boolean usePseudoInverse, List<Integer> rows) Returns the covariance matrix of the regression of the ith variable on its parents and the regression- Parameters:
- i- The index of the variable.
- parents- The indices of the parents.
- data- The data matrix.
- covariances- The covariance matrix.
- usePseudoInverse- True if the pseudo-inverse should be used instead of the inverse to avoid exceptions.
- rows- The rows to use.
- Returns:
- The covariance matrix of the regression of the ith variable on its parents and the regression
 
- 
setUsePseudoInversepublic void setUsePseudoInverse(boolean usePseudoInverse) Returns the covariance matrix of the regression of the ith variable on its parents and the regression coefficients.- Parameters:
- usePseudoInverse- True if the pseudo-inverse should be used instead of the inverse to avoid exceptions.
 
- 
localScoreDiffpublic double localScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.- Specified by:
- localScoreDiffin interface- Score
- Parameters:
- x- A node.
- y- TAhe node.
- z- A set of nodes.
- Returns:
- The score difference.
 
- 
nandyBicpublic double nandyBic(int x, int y, int[] z) nandyBic. - Parameters:
- x- a int
- y- a int
- z- an array of- intobjects
- Returns:
- a double
 
- 
localScorepublic double localScore(int i, int... parents) Returns the score for the given node and its parents.- Specified by:
- localScorein interface- Score
- Parameters:
- i- The index of the node.
- parents- The indices of the node's parents.
- Returns:
- The score, or NaN if the score cannot be calculated.
 
- 
getPenaltyDiscountpublic double getPenaltyDiscount()Returns the multiplier on the penalty term for this score.- Returns:
- The multiplier on the penalty term for this score.
 
- 
setPenaltyDiscountpublic void setPenaltyDiscount(double penaltyDiscount) Sets the multiplier on the penalty term for this score.- Parameters:
- penaltyDiscount- The multiplier on the penalty term for this score.
 
- 
getStructurePriorpublic double getStructurePrior()Returns the structure prior for this score.- Returns:
- The structure prior for this score.
 
- 
setStructurePriorpublic void setStructurePrior(double structurePrior) Sets the structure prior for this score.- Parameters:
- structurePrior- The structure prior for this score.
 
- 
getCovariancesReturns the covariance matrix.- Returns:
- The covariance matrix.
 
- 
getSampleSizepublic int getSampleSize()Returns the sample size.- Specified by:
- getSampleSizein interface- Score
- Returns:
- The sample size.
 
- 
isEffectEdgepublic boolean isEffectEdge(double bump) Returns true iff the edge between x and y is an effect edge.Returns true if the given bump is an effect edge. - Specified by:
- isEffectEdgein interface- Score
- Parameters:
- bump- The bump.
- Returns:
- True iff the edge between x and y is an effect edge.
 
- 
getDataModelReturns the data model.- Returns:
- The data model.
 
- 
isVerbosepublic boolean isVerbose()Returns true if verbose output should be sent to out.- Returns:
- True if verbose output should be sent to out.
 
- 
setVerbosepublic void setVerbose(boolean verbose) Sets whether verbose output should be sent to out.- Parameters:
- verbose- True if verbose output should be sent to out.
 
- 
getVariablesThe variables of the score.Returns the variables of the covariance matrix. - Specified by:
- getVariablesin interface- Score
- Returns:
- This list.
 
- 
setVariablesSets the variables of the covariance matrix.- Parameters:
- variables- The variables of the covariance matrix.
 
- 
getMaxDegreepublic int getMaxDegree()Returns the max degree, by default 1000.Returns the maximum degree of the score. - Specified by:
- getMaxDegreein interface- Score
- Returns:
- The max degree.
 
- 
determinesReturns true iff the score determines the edge between x and y.Returns true is the variables in z determine the variable y. - Specified by:
- determinesin interface- Score
- Parameters:
- z- The set of nodes.
- y- The node.
- Returns:
- True iff the score determines the edge between x and y.
 
- 
getDataReturns the data model.- Returns:
- The data model.
 
- 
setRuleTypeSets the rule type to use.- Parameters:
- ruleType- The rule type to use.
- See Also:
 
- 
subsetReturns a SEM BIC score for the given subset of variables.- Parameters:
- subset- The subset of variables.
- Returns:
- A SEM BIC score for the given subset of variables.
 
- 
toStringReturns a string representation of this score.
 
-