Class IndTestHsic

java.lang.Object
edu.cmu.tetrad.search.test.IndTestHsic
All Implemented Interfaces:
IndependenceTest

public final class IndTestHsic extends Object implements 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.

Author:
Robert Tillman
See Also:
  • Constructor Details

    • IndTestHsic

      public IndTestHsic(DataSet dataSet, double alpha)
      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

      public IndTestHsic(Matrix data, List<Node> variables, double alpha)
      Constructs a new HSIC Independence test. The given significance level is used.
      Parameters:
      data - A matrix of continuous data.
      variables - The list of variables for the data.
      alpha - The alpha level of the test.
  • Method Details

    • indTestSubset

      public IndependenceTest indTestSubset(List<Node> vars)
      Creates a new IndTestHsic instance for a subset of the variables.
      Specified by:
      indTestSubset in interface IndependenceTest
      Parameters:
      vars - The sublist of variables.
      Returns:
      This sublist.
    • checkIndependence

      public IndependenceResult checkIndependence(Node y, Node x, Set<Node> _z)
      Determines whether variable x is independent of variable y given a list of conditioning variables z.
      Specified by:
      checkIndependence in interface IndependenceTest
      Parameters:
      x - the one variable being compared.
      y - the second variable being compared.
      _z - the list of conditioning variables.
      Returns:
      True iff x _||_ y | z.
      See Also:
    • empiricalHSIC

      public double empiricalHSIC(Matrix Ky, Matrix Kx, int m)
      Empirical unconditional Hilbert-Schmidt Dependence Measure for X and Y
      Parameters:
      Ky - centralized Gram matrix for Y
      Kx - centralized Gram matrix for X
      m - sample size
    • empiricalHSICincompleteCholesky

      public double empiricalHSICincompleteCholesky(Matrix Gy, Matrix Gx, int m)
      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 Y
      Gx - Choleksy approximate Gram matrix for X
      m - sample size
    • empiricalHSICincompleteCholesky

      public double 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 matrices
      Parameters:
      Gy - Choleksy approximate Gram matrix for Y
      Gx - Choleksy approximate Gram matrix for X
      Gz - Choleksy approximate Gram matrix for Z
      m - sample size
    • 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 interface IndependenceTest
      Returns:
      This alpha.
    • setAlpha

      public void setAlpha(double alpha)
      Sets the significance level at which independence judgments should be made.
      Specified by:
      setAlpha in interface IndependenceTest
      Parameters:
      alpha - This alpha.
    • getVariables

      public List<Node> 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 interface IndependenceTest
      Returns:
      This list.
    • getVariable

      public Node getVariable(String name)
      Returns the variable with the given name.
      Specified by:
      getVariable in interface IndependenceTest
      Returns:
      This string.
    • getData

      public DataSet getData()
      Returns the data set being analyzed.
      Specified by:
      getData in interface IndependenceTest
      Returns:
      This data.
      See Also:
    • toString

      public String toString()
      Returns a string representation of this test.
      Specified by:
      toString in interface IndependenceTest
      Overrides:
      toString in class Object
      Returns:
      This string.
    • determines

      public boolean determines(List<Node> z, Node x) throws UnsupportedOperationException
      Throws:
      UnsupportedOperationException - Method not supported.
    • isVerbose

      public boolean isVerbose()
      Description copied from interface: IndependenceTest
      Returns true if the test prints verbose output.
      Specified by:
      isVerbose in interface IndependenceTest
      Returns:
      True if the case.
    • setVerbose

      public void setVerbose(boolean verbose)
      Description copied from interface: IndependenceTest
      Sets whether this test will print verbose output.
      Specified by:
      setVerbose in interface IndependenceTest
      Parameters:
      verbose - True, if so.