Class R0R4StrategyTestBased

java.lang.Object
edu.cmu.tetrad.search.utils.R0R4StrategyTestBased
All Implemented Interfaces:
R0R4Strategy

public class R0R4StrategyTestBased extends Object implements R0R4Strategy
The FciOrientDataExaminationStrategyTestBased class implements the FciOrientDataExaminationStrategy interface and provides methods for checking unshielded colliders and determining orientations based on the Discriminating Path Rule.

This classes uses a test to determine the sepset for two nodes, e and c, which can only be determined by looking at the data.

Author:
jdramsey
See Also:
  • Constructor Details

    • R0R4StrategyTestBased

      public R0R4StrategyTestBased(IndependenceTest test)
      Creates a new instance of FciOrientDataExaminationStrategyTestBased.
      Parameters:
      test - the IndependenceTest object used by the strategy
  • Method Details

    • specialConfiguration

      public static R0R4Strategy specialConfiguration(IndependenceTest test, Knowledge knowledge, boolean doDiscriminatingPathTailRule, boolean doDiscriminatingPathColliderRule, boolean verbose)
      Provides a special configuration for creating an instance of FciOrientDataExaminationStrategy.
      Parameters:
      test - the IndependenceTest object used by the strategy
      knowledge - the Knowledge object used by the strategy
      doDiscriminatingPathTailRule - boolean indicating whether to use the Discriminating Path Tail Rule
      doDiscriminatingPathColliderRule - boolean indicating whether to use the Discriminating Path Collider Rule
      verbose - boolean indicating whether to provide verbose output
      Returns:
      a configured FciOrientDataExaminationStrategy object
      Throws:
      IllegalArgumentException - if test or knowledge is null
    • defaultConfiguration

      public static R0R4Strategy defaultConfiguration(Graph dag, Knowledge knowledge)
      Returns a default configuration of the FciOrientDataExaminationStrategy object.
      Parameters:
      dag - the graph representation
      knowledge - the Knowledge object used by the strategy
      Returns:
      a default configured FciOrientDataExaminationStrategy object
    • defaultConfiguration

      public static R0R4Strategy defaultConfiguration(IndependenceTest test, Knowledge knowledge)
      Returns a default configuration of the FciOrientDataExaminationStrategy object.
      Parameters:
      test - the IndependenceTest object used by the strategy
      knowledge - the Knowledge object used by the strategy
      Returns:
      a configured FciOrientDataExaminationStrategy object
      Throws:
      IllegalArgumentException - if test or knowledge is null
    • isUnshieldedCollider

      public boolean isUnshieldedCollider(Graph graph, Node i, Node j, Node k)
      Checks if a collider is unshielded or not.
      Specified by:
      isUnshieldedCollider in interface R0R4Strategy
      Parameters:
      graph - the graph containing the nodes
      i - the first node of the collider
      j - the second node of the collider
      k - the third node of the collider
      Returns:
      true if the collider is unshielded, false otherwise
    • doDiscriminatingPathOrientation

      public org.apache.commons.lang3.tuple.Pair<DiscriminatingPath,Boolean> doDiscriminatingPathOrientation(DiscriminatingPath discriminatingPath, Graph graph)
      Does a discriminating path orientation.
      Specified by:
      doDiscriminatingPathOrientation in interface R0R4Strategy
      Parameters:
      discriminatingPath - the discriminating path
      graph - the graph representation
      Returns:
      The discriminating path is returned as the first element of the pair, and a boolean indicating whether the orientation was done is returned as the second element of the pair.
      Throws:
      IllegalArgumentException - if 'e' is adjacent to 'c'
      See Also:
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets the knowledge object used by the FciOrientDataExaminationStrategy.
      Specified by:
      setKnowledge in interface R0R4Strategy
      Parameters:
      knowledge - the knowledge object to be set
    • getknowledge

      public Knowledge getknowledge()
      Retrieves the Knowledge object used by the FciOrientDataExaminationStrategy.
      Specified by:
      getknowledge in interface R0R4Strategy
      Returns:
      the Knowledge object used by the strategy
    • setAllowedColliders

      public void setAllowedColliders(Set<Triple> allowedColliders)
      Sets the allowed colliders for the FciOrientDataExaminationStrategy.
      Specified by:
      setAllowedColliders in interface R0R4Strategy
      Parameters:
      allowedColliders - the Set of Triples representing allowed colliders
    • setVerbose

      public void setVerbose(boolean verbose)
      Sets the verbose mode for the FciOrientDataExaminationStrategy object.
      Parameters:
      verbose - true to enable verbose output, false otherwise
    • setDepth

      public void setDepth(int depth)
      Sets the depth for the FciOrientDataExaminationStrategy object.
      Parameters:
      depth - the depth to be set for the strategy
    • getTest

      public IndependenceTest getTest()
      Retrieves the IndependenceTest object used by the strategy.
      Returns:
      the IndependenceTest object used by the strategy
    • isDoDiscriminatingPathColliderRule

      public boolean isDoDiscriminatingPathColliderRule()
      Determines whether the Discriminating Path Collider Rule is enabled or not.
      Returns:
      true if the Discriminating Path Collider Rule is enabled, false otherwise
    • setDoDiscriminatingPathColliderRule

      public void setDoDiscriminatingPathColliderRule(boolean doDiscriminatingPathColliderRule)
      Sets the value indicating whether to use the Discriminating Path Collider Rule.
      Parameters:
      doDiscriminatingPathColliderRule - boolean value indicating whether to use the Discriminating Path Collider Rule
    • isDoDiscriminatingPathTailRule

      public boolean isDoDiscriminatingPathTailRule()
      Returns the value indicating whether the Discriminating Path Tail Rule is enabled or not.
      Returns:
      true if the Discriminating Path Tail Rule is enabled, false otherwise
    • setDoDiscriminatingPathTailRule

      public void setDoDiscriminatingPathTailRule(boolean doDiscriminatingPathTailRule)
      Sets the value indicating whether to use the Discriminating Path Tail Rule.
      Parameters:
      doDiscriminatingPathTailRule - boolean value indicating whether to use the Discriminating Path Tail Rule
    • getInitialAllowedColliders

      public Set<Triple> getInitialAllowedColliders()
      Retrieves the initial set of allowed colliders.
      Specified by:
      getInitialAllowedColliders in interface R0R4Strategy
      Returns:
      The initial set of allowed colliders.
    • setInitialAllowedColliders

      public void setInitialAllowedColliders(HashSet<Triple> initialAllowedColliders)
      Sets the initial set of allowed colliders for the FciOrientDataExaminationStrategy.
      Specified by:
      setInitialAllowedColliders in interface R0R4Strategy
      Parameters:
      initialAllowedColliders - the HashSet containing the initial allowed colliders