Class SepsetsGreedy

java.lang.Object
edu.cmu.tetrad.search.utils.SepsetsGreedy
All Implemented Interfaces:
SepsetProducer

public class SepsetsGreedy extends Object implements SepsetProducer
Provides a SepsetProducer that selects the first sepset it comes to from among the extra sepsets or the adjacents of i or k, or null if none is found.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • SepsetsGreedy

      public SepsetsGreedy(Graph graph, IndependenceTest independenceTest, int depth)

      Constructor for Sepsets.

      Parameters:
      graph - a Graph object
      independenceTest - a IndependenceTest object
      depth - a int
  • Method Details

    • getSepset

      public Set<Node> getSepset(Node i, Node k, int depth)
      Retrieves the sepset (separating set) between two nodes, or null if no such sepset is found.
      Specified by:
      getSepset in interface SepsetProducer
      Parameters:
      i - The first node
      k - The second node
      depth - The depth of the search
      Returns:
      The sepset between the two nodes
    • getSepsetContaining

      public Set<Node> getSepsetContaining(Node i, Node k, Set<Node> s, int depth)
      Retrieves a sepset (separating set) between two nodes containing a set of nodes, containing the nodes in s, or null if no such sepset is found. If there is no required set of nodes, pass null for the set.
      Specified by:
      getSepsetContaining in interface SepsetProducer
      Parameters:
      i - The first node
      k - The second node
      s - The set of nodes that must be contained in the sepset, or null if no such set is required.
      depth - The depth of the search
      Returns:
      The sepset between the two nodes
    • isUnshieldedCollider

      public boolean isUnshieldedCollider(Node i, Node j, Node k, int depth)

      isUnshieldedCollider.

      Specified by:
      isUnshieldedCollider in interface SepsetProducer
      Parameters:
      i - a Node object
      j - a Node object
      k - a Node object
      depth - the depth of the search
      Returns:
      a boolean
    • isIndependent

      public boolean isIndependent(Node a, Node b, Set<Node> sepset)
      Checks if node d is independent of node c given the set of nodes in sepset.
      Specified by:
      isIndependent in interface SepsetProducer
      Parameters:
      a - the first node
      b - the second node
      sepset - the set of common neighbors between d and c
      Returns:
      true if d is independent of c, false otherwise
    • getPValue

      public double getPValue(Node a, Node b, Set<Node> sepset)
      Returns the p-value for the independence test between two nodes, given a set of separator nodes.
      Specified by:
      getPValue in interface SepsetProducer
      Parameters:
      a - the first node
      b - the second node
      sepset - the set of separator nodes
      Returns:
      the p-value for the independence test
    • setGraph

      public void setGraph(Graph graph)
      Sets the graph for the Sepsets object.
      Specified by:
      setGraph in interface SepsetProducer
      Parameters:
      graph - The graph to set.
    • getScore

      public double getScore()
      Calculates the score for the given Sepsets object.
      Specified by:
      getScore in interface SepsetProducer
      Returns:
      The score calculated based on the result's p-value and the independence test's alpha value.
    • getVariables

      public List<Node> getVariables()
      Retrieves the variables used in the independence test.
      Specified by:
      getVariables in interface SepsetProducer
      Returns:
      A list of Node objects representing the variables used in the independence test.
    • isVerbose

      public boolean isVerbose()
      Returns whether the object is in verbose mode.
      Returns:
      true if the object is in verbose mode, false otherwise
    • setVerbose

      public void setVerbose(boolean verbose)
      Sets the verbosity level for this object. When verbose mode is set to true, additional debugging information will be printed during the execution of this method.
      Specified by:
      setVerbose in interface SepsetProducer
      Parameters:
      verbose - The verbosity level to set. Set to true for verbose output, false otherwise.
    • getDag

      public Graph getDag()
      Retrieves the Directed Acyclic Graph (DAG) produced by the Sepsets algorithm.
      Returns:
      The DAG produced by the Sepsets algorithm, or null if the independence test is not an instance of MsepTest.