Package edu.cmu.tetrad.search.score
Class BasisFunctionBicScoreFullSample
java.lang.Object
edu.cmu.tetrad.search.score.BasisFunctionBicScoreFullSample
- All Implemented Interfaces:
Score
Calculates the basis function BIC score for a given dataset. This is a generalization of the Degenerate Gaussian
score by adding basis functions of the continuous variables and retains the function of the degenerate Gaussian for
discrete variables by adding indicator variables per category.
This version uses a tabular approach to calculate the score rather than using covariance matrices.
- Author:
- josephramsey, bryanandrews
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBasisFunctionBicScoreFullSample(DataSet dataSet, int truncationLimit, double lambda) Constructs a BasisFunctionBicScore object with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.ejml.simple.SimpleMatrixcomputeOLS(org.ejml.simple.SimpleMatrix B, org.ejml.simple.SimpleMatrix X, double lambda) Computes the Ordinary Least Squares (OLS) regression coefficients with L2 regularization.intRetrieves the maximum degree from the underlying BIC score component.intRetrieves the sample size from the underlying BIC score component.Retrieves the list of nodes representing the variables in the basis function score.booleanisEffectEdge(double bump) Determines if the given bump value represents an effect edge.doublelocalScore(int i, int... parents) Calculates the local score for a given node and its parent nodes.doublelocalScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.voidsetDoOneEquationOnly(boolean doOneEquationOnly) When calculation the score for X = <X1 = X, X2, X3,..., Xp> use the equation for X1 only, if true; otherwise, use equations for all of X1, X2,...,Xp.voidsetPenaltyDiscount(double penaltyDiscount) Sets the penalty discount value, which is used to adjust the penalty term in the BIC score calculation.toString()Returns a string representation of the BasisFunctionBicScore object.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
-
BasisFunctionBicScoreFullSample
Constructs a BasisFunctionBicScore object with the specified parameters.- Parameters:
dataSet- the data set on which the score is to be calculated. May contain a mixture of discrete and continuous variables.truncationLimit- the truncation limit of the basis.lambda- Singularity lambda- See Also:
-
-
Method Details
-
computeOLS
public static org.ejml.simple.SimpleMatrix computeOLS(org.ejml.simple.SimpleMatrix B, org.ejml.simple.SimpleMatrix X, double lambda) Computes the Ordinary Least Squares (OLS) regression coefficients with L2 regularization.- Parameters:
B- The design matrix where each row represents a sample and each column represents a feature.X- The matrix containing the target values for corresponding samples.lambda- The regularization parameter to control overfitting (L2 regularization).- Returns:
- A matrix representing the OLS regression coefficients.
-
localScore
public double localScore(int i, int... parents) Calculates the local score for a given node and its parent nodes.- Specified by:
localScorein interfaceScore- Parameters:
i- The index of the node whose score is being calculated.parents- The indices for the parent nodes of the given node.- Returns:
- The calculated local score as a double value.
-
localScoreDiff
public double localScoreDiff(int x, int y, int[] z) Description copied from interface:ScoreReturns the score difference of the graph.- Specified by:
localScoreDiffin interfaceScore- Parameters:
x- A node.y- TAhe node.z- A set of nodes.- Returns:
- The score difference.
-
getVariables
Retrieves the list of nodes representing the variables in the basis function score.- Specified by:
getVariablesin interfaceScore- Returns:
- a list containing the nodes that represent the variables in the basis function score.
-
isEffectEdge
public boolean isEffectEdge(double bump) Determines if the given bump value represents an effect edge.- Specified by:
isEffectEdgein interfaceScore- Parameters:
bump- the bump value to be evaluated.- Returns:
- true if the bump is an effect edge, false otherwise.
-
getSampleSize
public int getSampleSize()Retrieves the sample size from the underlying BIC score component.- Specified by:
getSampleSizein interfaceScore- Returns:
- the sample size as an integer
-
getMaxDegree
public int getMaxDegree()Retrieves the maximum degree from the underlying BIC score component.- Specified by:
getMaxDegreein interfaceScore- Returns:
- the maximum degree as an integer.
-
toString
Returns a string representation of the BasisFunctionBicScore object. -
setPenaltyDiscount
public void setPenaltyDiscount(double penaltyDiscount) Sets the penalty discount value, which is used to adjust the penalty term in the BIC score calculation.- Parameters:
penaltyDiscount- The multiplier on the penalty term for this score.
-
setDoOneEquationOnly
public void setDoOneEquationOnly(boolean doOneEquationOnly) When calculation the score for X = <X1 = X, X2, X3,..., Xp> use the equation for X1 only, if true; otherwise, use equations for all of X1, X2,...,Xp.- Parameters:
doOneEquationOnly- True if only the equation for X1 is to be used for X = X1,...,Xp. *
-