Package edu.cmu.tetrad.search.test
Class IndTestHsic
java.lang.Object
edu.cmu.tetrad.search.test.IndTestHsic
- All Implemented Interfaces:
IndependenceTest
Checks the conditional independence X _||_ Y | S, where S is a set of continuous variable, and X and Y are discrete
variable not in S, using the Hilbert-Schmidth Independence Criterion (HSIC), a kernel based nonparametric test for
conditional independence.
The Kpc algorithm by Tillman had run PC using this test; to run Kpc, simply select this test for PC.
- Version:
- $Id: $Id
- Author:
- Robert Tillman
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIndTestHsic
(DataSet dataSet, double alpha) Constructs a new HSIC Independence test.IndTestHsic
(Matrix data, List<Node> variables, double alpha) Constructs a new HSIC Independence test. -
Method Summary
Modifier and TypeMethodDescriptioncheckIndependence
(Node y, Node x, Set<Node> _z) Determines whether variable x is independent of variable y given a list of conditioning variables z.boolean
determines
(List<Node> z, Node x) Determines whether variable x is independent of variable y given a list of conditioning variables z.double
empiricalHSIC
(Matrix Ky, Matrix Kx, int m) Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Ydouble
empiricalHSICincompleteCholesky
(Matrix Gy, Matrix Gx, int m) Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Y using incomplete Cholesky decomposition to approximate Gram matricesdouble
empiricalHSICincompleteCholesky
(Matrix Gy, Matrix Gx, Matrix Gz, int m) Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Y given Z using incomplete Cholesky decomposition to approximate Gram matricesdouble
getAlpha()
Gets the getModel significance level.getData()
Returns the data set being analyzed.getVariable
(String name) Returns the variable with the given name.Returns the list of variables over which this independence checker is capable of determinine independence relations-- that is, all the variables in the given graph or the given data set.indTestSubset
(List<Node> vars) Subset of variables for independence testing.boolean
Determines if the verbose mode is enabled.void
setAlpha
(double alpha) Sets the significance level.void
setIncompleteCholesky
(double precision) Sets the precision for the Incomplete Choleksy factorization method for approximating Gram matrices.void
setPerms
(int numBootstraps) Set the number of bootstrap samples to usevoid
setRegularizer
(double regularizer) Sets the regularizer.void
setVerbose
(boolean verbose) Sets the verbose mode for the IndTestHsic class.toString()
Returns a string representation of this test.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.search.IndependenceTest
checkIndependence, determines, getCov, getDataSets, getSampleSize, getVariableNames
-
Constructor Details
-
IndTestHsic
Constructs a new HSIC Independence test. The given significance level is used.- Parameters:
dataSet
- A data set containing only continuous columns.alpha
- The alpha level of the test.
-
IndTestHsic
-
-
Method Details
-
indTestSubset
Subset of variables for independence testing.- Specified by:
indTestSubset
in interfaceIndependenceTest
- Parameters:
vars
- The list of variables for the subset.- Returns:
- An IndependenceTest object representing the subset for independence testing.
- Throws:
IllegalArgumentException
- If the subset is empty or contains variables not in the original set.
-
checkIndependence
Determines whether variable x is independent of variable y given a list of conditioning variables z.- Specified by:
checkIndependence
in interfaceIndependenceTest
- Parameters:
y
- aNode
objectx
- aNode
object_z
- aSet
object- Returns:
- a
IndependenceResult
object - See Also:
-
empiricalHSIC
-
empiricalHSICincompleteCholesky
Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Y using incomplete Cholesky decomposition to approximate Gram matrices- Parameters:
Gy
- Choleksy approximate Gram matrix for YGx
- Choleksy approximate Gram matrix for Xm
- sample size- Returns:
- a double
-
empiricalHSICincompleteCholesky
Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Y given Z using incomplete Cholesky decomposition to approximate Gram matrices- Parameters:
Gy
- Choleksy approximate Gram matrix for YGx
- Choleksy approximate Gram matrix for XGz
- Choleksy approximate Gram matrix for Zm
- sample size- Returns:
- a double
-
setIncompleteCholesky
public void setIncompleteCholesky(double precision) Sets the precision for the Incomplete Choleksy factorization method for approximating Gram matrices. A value <= 0 indicates that the Incomplete Cholesky method should not be used and instead use the exact matrices.- Parameters:
precision
- This precision.
-
setPerms
public void setPerms(int numBootstraps) Set the number of bootstrap samples to use- Parameters:
numBootstraps
- This number.
-
setRegularizer
public void setRegularizer(double regularizer) Sets the regularizer.- Parameters:
regularizer
- This value.
-
getAlpha
public double getAlpha()Gets the getModel significance level.- Specified by:
getAlpha
in interfaceIndependenceTest
- Returns:
- This alpha.
-
setAlpha
public void setAlpha(double alpha) Sets the significance level.Sets the significance level at which independence judgments should be made.
- Specified by:
setAlpha
in interfaceIndependenceTest
- Parameters:
alpha
- This level.
-
getVariables
Returns the list of variables over which this independence checker is capable of determinine independence relations-- that is, all the variables in the given graph or the given data set.- Specified by:
getVariables
in interfaceIndependenceTest
- Returns:
- This list.
-
getVariable
Returns the variable with the given name.- Specified by:
getVariable
in interfaceIndependenceTest
- Parameters:
name
- The name of the variable to retrieve.- Returns:
- The variable with the given name, or null if no variable with that name is found.
-
getData
Returns the data set being analyzed.- Specified by:
getData
in interfaceIndependenceTest
- Returns:
- This data.
- See Also:
-
toString
Returns a string representation of this test.- Specified by:
toString
in interfaceIndependenceTest
- Overrides:
toString
in classObject
- Returns:
- This string.
-
determines
Determines whether variable x is independent of variable y given a list of conditioning variables z.- Parameters:
z
- A list of conditioning variables.x
- The variable x to be tested.- Returns:
- True if variable x is independent of variable y given the conditioning variables z, false otherwise.
- Throws:
UnsupportedOperationException
- This method is not implemented.
-
isVerbose
public boolean isVerbose()Determines if the verbose mode is enabled.- Specified by:
isVerbose
in interfaceIndependenceTest
- Returns:
- true if the verbose mode is enabled, false otherwise.
-
setVerbose
public void setVerbose(boolean verbose) Sets the verbose mode for the IndTestHsic class.- Specified by:
setVerbose
in interfaceIndependenceTest
- Parameters:
verbose
- true to enable verbose mode, false to disable it.
-