java.lang.Object
edu.cmu.tetrad.search.work_in_progress.Kpc
All Implemented Interfaces:
IGraphSearch

public class Kpc extends Object implements IGraphSearch

Kernelized PC algorithm. This is the same as the PC class, the nonparametric kernel-based HSIC test is used for independence testing and the parameters for this test can be set directly when Kpc is initialized.

Moving this to the work_in_progress package because it has not been tested in a very long time, and there is another option available that has been tested, namely, to run PC using the KCI test due to Kun Zhang.

Version:
$Id: $Id
Author:
Robert Tillman.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Kpc(DataSet dataset, double alpha)
    Constructs a new PC search using for the given dataset.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the getModel significance level.
    int
    Getter for the field depth.
    long
    Getter for the field elapsedTime.
    Getter for the field independenceTest.
    Getter for the field knowledge.
    int
    Gets the getModel number of bootstrap samples used
    double
    Gets the getModel precision for the Incomplete Cholesky
    Getter for the field sepset.
    Getter for the field unshieldedColliders.
    Getter for the field unshieldedNoncolliders.
    boolean
    isMeekPreventCycles.
    Runs PC starting with a complete graph over all nodes of the given conditional independence test, using the given independence test and knowledge and returns the resultant graph.
    search(List<Node> nodes)
    Runs PC starting with a commplete graph over the given list of nodes, using the given independence test and knowledge and returns the resultant graph.
    void
    setAlpha(double alpha)
    Sets the significance level at which independence judgments should be made.
    void
    setDepth(int depth)
    Sets the depth of the search--that is, the maximum number of conditioning nodes for any conditional independence checked.
    void
    Sets the knowledge specification to be used in the search.
    void
    setMeekPreventCycles(boolean meekPreventCycles)
    Setter for the field meekPreventCycles.
    void
    setPerms(int perms)
    Set the number of bootstrap samples to use
    void
    setVerbose(boolean verbose)
    Sets whether verbose output should be printed.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Kpc

      public Kpc(DataSet dataset, double alpha)
      Constructs a new PC search using for the given dataset.
      Parameters:
      dataset - The oracle for conditional independence facts. This does not make a copy of the independence test, for fear of duplicating the data set!
      alpha - a double
  • Method Details

    • isMeekPreventCycles

      public boolean isMeekPreventCycles()

      isMeekPreventCycles.

      Returns:
      true iff edges will not be added if they would create cycles.
    • setMeekPreventCycles

      public void setMeekPreventCycles(boolean meekPreventCycles)

      Setter for the field meekPreventCycles.

      Parameters:
      meekPreventCycles - Set to true just in case edges will not be addeds if they would create cycles.
    • getIndependenceTest

      public IndependenceTest getIndependenceTest()

      Getter for the field independenceTest.

      Returns:
      the independence test being used in the search.
    • getKnowledge

      public Knowledge getKnowledge()

      Getter for the field knowledge.

      Returns:
      the knowledge specification used in the search. Non-null.
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets the knowledge specification to be used in the search. May not be null.
      Parameters:
      knowledge - a Knowledge object
    • getSepset

      public SepsetMap getSepset()

      Getter for the field sepset.

      Returns:
      the sepset map from the most recent search. Non-null after the first call to search().
    • getDepth

      public int getDepth()

      Getter for the field depth.

      Returns:
      the getModel depth of search--that is, the maximum number of conditioning nodes for any conditional independence checked.
    • setDepth

      public void setDepth(int depth)
      Sets the depth of the search--that is, the maximum number of conditioning nodes for any conditional independence checked.
      Parameters:
      depth - The depth of the search. The default is 1000. A value of -1 may be used to indicate that the depth should be high (1000). A value of Integer.MAX_VALUE may not be used, due to a bug on multi-core machines.
    • search

      public Graph search()
      Runs PC starting with a complete graph over all nodes of the given conditional independence test, using the given independence test and knowledge and returns the resultant graph. The returned graph will be a CPDAG if the independence information is consistent with the hypothesis that there are no latent common causes. It may, however, contain cycles or bidirected edges if this assumption is not born out, either due to the actual presence of latent common causes, or due to statistical errors in conditional independence judgments.
      Specified by:
      search in interface IGraphSearch
      Returns:
      a Graph object
    • search

      public Graph search(List<Node> nodes)
      Runs PC starting with a commplete graph over the given list of nodes, using the given independence test and knowledge and returns the resultant graph. The returned graph will be a CPDAG if the independence information is consistent with the hypothesis that there are no latent common causes. It may, however, contain cycles or bidirected edges if this assumption is not born out, either due to the actual presence of latent common causes, or due to statistical errors in conditional independence judgments.

      All of the given nodes must be in the domain of the given conditional independence test.

      Parameters:
      nodes - a List object
      Returns:
      a Graph object
    • getElapsedTime

      public long getElapsedTime()

      Getter for the field elapsedTime.

      Returns:
      the elapsed time of the search, in milliseconds.
    • getUnshieldedColliders

      public Set<Triple> getUnshieldedColliders()

      Getter for the field unshieldedColliders.

      Returns:
      the set of unshielded colliders in the graph returned by search(). Non-null after search is called.
    • getUnshieldedNoncolliders

      public Set<Triple> getUnshieldedNoncolliders()

      Getter for the field unshieldedNoncolliders.

      Returns:
      the set of unshielded noncolliders in the graph returned by search(). Non-null after search is called.
    • setVerbose

      public void setVerbose(boolean verbose)
      Sets whether verbose output should be printed.
      Parameters:
      verbose - True, if so.
    • getAlpha

      public double getAlpha()
      Gets the getModel significance level.
      Returns:
      a double
    • setAlpha

      public void setAlpha(double alpha)
      Sets the significance level at which independence judgments should be made.
      Parameters:
      alpha - a double
    • getPrecision

      public double getPrecision()
      Gets the getModel precision for the Incomplete Cholesky
      Returns:
      a double
    • getPerms

      public int getPerms()
      Gets the getModel number of bootstrap samples used
      Returns:
      a int
    • setPerms

      public void setPerms(int perms)
      Set the number of bootstrap samples to use
      Parameters:
      perms - a int