Package edu.cmu.tetrad.search.utils
Class R0R4StrategyTestBased
java.lang.Object
edu.cmu.tetrad.search.utils.R0R4StrategyTestBased
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the different types of blocking strategies. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of FciOrientDataExaminationStrategyTestBased. -
Method Summary
Modifier and TypeMethodDescriptionstatic R0R4Strategy
defaultConfiguration
(Graph dag, Knowledge knowledge) Returns a default configuration of the FciOrientDataExaminationStrategy object.static R0R4Strategy
defaultConfiguration
(IndependenceTest test, Knowledge knowledge) Returns a default configuration of the FciOrientDataExaminationStrategy object.org.apache.commons.lang3.tuple.Pair
<DiscriminatingPath, Boolean> doDiscriminatingPathOrientation
(DiscriminatingPath discriminatingPath, Graph graph, Set<Node> vNodes) Does a discriminating path orientation.The Set of Triples representing the allowed colliders for the FciOrientDataExaminationStrategy.Retrieves the initial set of allowed colliders.Retrieves the Knowledge object used by the FciOrientDataExaminationStrategy.getTest()
Retrieves the IndependenceTest object used by the strategy.boolean
isUnshieldedCollider
(Graph graph, Node i, Node j, Node k) Checks if a collider is unshielded or not.void
setAllowedColliders
(Set<Triple> allowedColliders) Sets the allowed colliders for the FciOrientDataExaminationStrategy.void
setBlockingType
(R0R4StrategyTestBased.BlockingType blockingType) Sets the blocking type for the strategy.void
setDepth
(int depth) Sets the depth for the FciOrientDataExaminationStrategy object.void
setEnsureMarkovHelper
(EnsureMarkov ensureMarkovHelper) Sets the EnsureMarkov object used by the R0R4StrategyTestBased.void
setInitialAllowedColliders
(HashSet<Triple> initialAllowedColliders) Sets the initial set of allowed colliders for the FciOrientDataExaminationStrategy.void
setKnowledge
(Knowledge knowledge) Sets the knowledge object used by the FciOrientDataExaminationStrategy.void
setMaxLength
(int maxLength) Sets the maximum length for relevant paths.void
Sets the PAG (partial ancestral graph) for the strategy.void
setVerbose
(boolean verbose) Sets the verbose mode for the FciOrientDataExaminationStrategy object.static R0R4Strategy
specialConfiguration
(IndependenceTest test, Knowledge knowledge, boolean verbose) Provides a special configuration for creating an instance of FciOrientDataExaminationStrategy.
-
Constructor Details
-
R0R4StrategyTestBased
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 verbose) Provides a special configuration for creating an instance of FciOrientDataExaminationStrategy.- Parameters:
test
- the IndependenceTest object used by the strategyknowledge
- the Knowledge object used by the strategyverbose
- boolean indicating whether to provide verbose output- Returns:
- a configured FciOrientDataExaminationStrategy object
- Throws:
IllegalArgumentException
- if test or knowledge is null
-
defaultConfiguration
Returns a default configuration of the FciOrientDataExaminationStrategy object.- Parameters:
dag
- the graph representationknowledge
- the Knowledge object used by the strategy- Returns:
- a default configured FciOrientDataExaminationStrategy object
-
defaultConfiguration
Returns a default configuration of the FciOrientDataExaminationStrategy object.- Parameters:
test
- the IndependenceTest object used by the strategyknowledge
- the Knowledge object used by the strategy- Returns:
- a configured FciOrientDataExaminationStrategy object
- Throws:
IllegalArgumentException
- if test or knowledge is null
-
isUnshieldedCollider
Checks if a collider is unshielded or not.- Specified by:
isUnshieldedCollider
in interfaceR0R4Strategy
- Parameters:
graph
- the graph containing the nodesi
- the first node of the colliderj
- the second node of the colliderk
- 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, Set<Node> vNodes) throws InterruptedException Does a discriminating path orientation.- Specified by:
doDiscriminatingPathOrientation
in interfaceR0R4Strategy
- Parameters:
discriminatingPath
- the discriminating pathgraph
- the graph representationvNodes
- the set of v-nodes- 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'InterruptedException
- See Also:
-
setKnowledge
Sets the knowledge object used by the FciOrientDataExaminationStrategy.- Specified by:
setKnowledge
in interfaceR0R4Strategy
- Parameters:
knowledge
- the knowledge object to be set
-
getknowledge
Retrieves the Knowledge object used by the FciOrientDataExaminationStrategy.- Specified by:
getknowledge
in interfaceR0R4Strategy
- Returns:
- the Knowledge object used by the strategy
-
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
Retrieves the IndependenceTest object used by the strategy.- Returns:
- the IndependenceTest object used by the strategy
-
getInitialAllowedColliders
Retrieves the initial set of allowed colliders.- Specified by:
getInitialAllowedColliders
in interfaceR0R4Strategy
- Returns:
- The initial set of allowed colliders.
-
setInitialAllowedColliders
Sets the initial set of allowed colliders for the FciOrientDataExaminationStrategy.- Specified by:
setInitialAllowedColliders
in interfaceR0R4Strategy
- Parameters:
initialAllowedColliders
- the HashSet containing the initial allowed colliders
-
setMaxLength
public void setMaxLength(int maxLength) Sets the maximum length for relevant paths.- Parameters:
maxLength
- the maximum length to be set. Set to -1 for no maximum length.
-
getAllowedColliders
The Set of Triples representing the allowed colliders for the FciOrientDataExaminationStrategy. This variable is initially set to null. Use the setAllowedColliders method to set the allowed colliders. Use the getInitialAllowedColliders method to retrieve the initial set of allowed colliders.- Returns:
- The Set of Triples representing the allowed colliders for the FciOrientDataExaminationStrategy.
-
setAllowedColliders
Sets the allowed colliders for the FciOrientDataExaminationStrategy.- Specified by:
setAllowedColliders
in interfaceR0R4Strategy
- Parameters:
allowedColliders
- the Set of Triples representing allowed colliders
-
setPag
Sets the PAG (partial ancestral graph) for the strategy.- Parameters:
pag
- the PAG to be set
-
setEnsureMarkovHelper
Sets the EnsureMarkov object used by the R0R4StrategyTestBased.- Parameters:
ensureMarkovHelper
- the EnsureMarkov object to be set
-
setBlockingType
Sets the blocking type for the strategy.- Parameters:
blockingType
- the blocking type to be set, which can be either RECURSIVE or GREEDY.
-