Package edu.cmu.tetrad.search
Class StarFci
java.lang.Object
edu.cmu.tetrad.search.StarFci
- All Implemented Interfaces:
IGraphSearch
*-FCI implements a template modification of GFCI that starts with a given Markov CPDAG and then fixes that result to
be correct for latent variables models. First, colliders from the Markov DAG are copied into the final circle-circle
graph, and some independence reasoning is used to remove edges from this and add the remaining colliders into the
graph. Then, the FCI final orientation rules are applied.
The Markov CPDAG needs to be supplied by classes inheriting from this abstract class using the getMarkovCpdag() methods.
The reference for the GFCI algorithm this is being modeled from is here:
Ogarrio, J. M., Spirtes, P., & Ramsey, J. (2016, August). A hybrid causal search algorithm for latent variable models. In Conference on probabilistic graphical models (pp. 368-379). PMLR.
We modify this by insistent that getMarkovCpdag() is overridden by a method that will return a CPDAG Markov to the data or underlying generative model and removing the possible d-sep step of the original algorithm.
This class is configured to respect knowledge of forbidden and required edges, including knowledge of temporal tiers.
- Author:
- josephramsey, bryanandrews
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionStarFci(IndependenceTest test) Constructs a new GFci algorithm with the given independence test and score. -
Method Summary
Modifier and TypeMethodDescriptionReturns the independence test used in search.Returns the knowledge used in search.abstract GraphReturns a Markov CPDAG to use as the initial graph in the Star-FCI search.booleanIndicates whether verbose output is enabled.search()Runs the graph and returns the search PAG.sepsetSubsetOfAdjxOrAdjy(Graph graph, Node x, Node y, Set<Node> containing, IndependenceTest test, int depth, List<Node> order, boolean useMaxP) Finds a separating set that is a subset of the adjacency of nodes x or y in the input graph.voidsetCompleteRuleSetUsed(boolean completeRuleSetUsed) Sets whether Zhang's complete rules are used.voidsetDepth(int depth) Sets the depth of the search for the possible m-sep search.voidsetGuaranteePag(boolean guaranteePag) Sets the flag indicating whether to guarantee the output is a legal PAG.voidsetKnowledge(Knowledge knowledge) Sets the knowledge to use in search.voidsetMaxDiscriminatingPathLength(int maxDiscriminatingPathLength) Sets the maximum length of any discriminating path.voidsetUseMaxP(boolean useMaxP) Sets whether to use the maxP criterion during the search process.voidsetVerbose(boolean verbose) Sets whether verbose output should be printed.
-
Constructor Details
-
StarFci
Constructs a new GFci algorithm with the given independence test and score.- Parameters:
test- The independence test to use.
-
-
Method Details
-
sepsetSubsetOfAdjxOrAdjy
public static Set<Node> sepsetSubsetOfAdjxOrAdjy(Graph graph, Node x, Node y, Set<Node> containing, IndependenceTest test, int depth, List<Node> order, boolean useMaxP) Finds a separating set that is a subset of the adjacency of nodes x or y in the input graph.- Parameters:
graph- The graph being analyzed.x- The first node between which independence is checked.y- The second node between which independence is checked.containing- A set of nodes that must be included in the separating set.test- The independence test used to evaluate separation.depth- The maximum size of subsets to be tested for independence.order- An optional list specifying the order of nodes for additional constraints.useMaxP- True if the maxP method should be used.- Returns:
- A separating set of nodes (if found) that is a subset of the adjacency of x or y, or
nullif no such set is found.
-
setUseMaxP
public void setUseMaxP(boolean useMaxP) Sets whether to use the maxP criterion during the search process.- Parameters:
useMaxP- A boolean indicating whether the maxP criterion should be applied (true) or not (false).
-
search
Runs the graph and returns the search PAG.- Specified by:
searchin interfaceIGraphSearch- Returns:
- This PAG.
- Throws:
InterruptedException- if any
-
getKnowledge
Returns the knowledge used in search.- Returns:
- This knowledge
-
setKnowledge
Sets the knowledge to use in search.- Parameters:
knowledge- This knowledge.
-
setCompleteRuleSetUsed
public void setCompleteRuleSetUsed(boolean completeRuleSetUsed) Sets whether Zhang's complete rules are used.- Parameters:
completeRuleSetUsed- set to true if Zhang's complete rule set should be used, false if only R1-R4 (the rule set of the original FCI) should be used. True by default.
-
setMaxDiscriminatingPathLength
public void setMaxDiscriminatingPathLength(int maxDiscriminatingPathLength) Sets the maximum length of any discriminating path.- Parameters:
maxDiscriminatingPathLength- the maximum length of any discriminating path, or -1 if unlimited.
-
isVerbose
public boolean isVerbose()Indicates whether verbose output is enabled.- Returns:
- true if verbose output is enabled, false otherwise.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output should be printed.- Parameters:
verbose- True, if so.
-
getIndependenceTest
Returns the independence test used in search.- Returns:
- This test.
-
setDepth
public void setDepth(int depth) Sets the depth of the search for the possible m-sep search.- Parameters:
depth- This depth.
-
setGuaranteePag
public void setGuaranteePag(boolean guaranteePag) Sets the flag indicating whether to guarantee the output is a legal PAG.- Parameters:
guaranteePag- A boolean value indicating whether to guarantee the output is a legal PAG.
-
getMarkovCpdag
Returns a Markov CPDAG to use as the initial graph in the Star-FCI search.- Returns:
- This CPDAG.
- Throws:
InterruptedException- if interrupted.
-