Class SpFci
- All Implemented Interfaces:
IGraphSearch
J.M. Ogarrio and P. Spirtes and J. Ramsey, "A Hybrid Causal Search Algorithm for Latent Variable Models," JMLR 2016. Here, SP has been substituted for FGES.
The reference for the SP algorithm is here:
Raskutti, G., & Uhler, C. (2018). Learning directed acyclic graph models based on sparsest permutations. Stat, 7(1), e183.
For SP only a score is needed, but there are steps in GFCI that require a test, so for this method, both a test and a score need to be given.
Note that SP considers all permutations of the algorithm, which is exponential in the number of variables. So SP is limited to about 10 variables.
This class is configured to respect knowledge of forbidden and required edges, including knowledge of temporal tiers.
- Version:
- $Id: $Id
- Author:
- josephramsey, bryan andrews
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSpFci
(IndependenceTest test, Score score) Constructor; requires by ta test and a score, over the same variables. -
Method Summary
Modifier and TypeMethodDescriptionReturns the independence test used in search.Returns the knowledge.int
Returns The maximum indegree of the output graph.int
Returns the maximum length of any discriminating path, or -1 of unlimited.boolean
Returns whether the complete rule set is used.search()
Runs the search and returns the discovered PAG.void
setCompleteRuleSetUsed
(boolean completeRuleSetUsed) Sets whether Zhang's complete rule set is used.void
setDepth
(int depth) Sets the maximum number of variables conditioned on.void
setGuaranteePag
(boolean guaranteePag) Sets whether the search should guarantee the output is a legal PAG.void
setKnowledge
(Knowledge knowledge) Sets the knoweldge used in the search.void
setMaxDegree
(int maxDegree) Sets the max degree of the search.void
setMaxDiscriminatingPathLength
(int maxDiscriminatingPathLength) Sets the maximum length of any discriminating path.void
setOut
(PrintStream out) Sets the output stream used to print.void
setSepsetFinderMethod
(int sepsetFinderMethod) Sets the method to use for finding sepsets, 1 = greedy, 2 = min-p., 3 = max-p, default min-p.void
setVerbose
(boolean verbose) Sets whether verbose output is printed.
-
Constructor Details
-
SpFci
Constructor; requires by ta test and a score, over the same variables.- Parameters:
test
- The test.score
- The score.
-
-
Method Details
-
search
Runs the search and returns the discovered PAG.- Specified by:
search
in interfaceIGraphSearch
- Returns:
- This PAG.
- Throws:
InterruptedException
- if any.
-
getMaxDegree
public int getMaxDegree()Returns The maximum indegree of the output graph.- Returns:
- This maximum.
-
setMaxDegree
public void setMaxDegree(int maxDegree) Sets the max degree of the search.- Parameters:
maxDegree
- This maximum.
-
getKnowledge
-
setKnowledge
Sets the knoweldge used in the search.- Parameters:
knowledge
- This knowledge.
-
isCompleteRuleSetUsed
public boolean isCompleteRuleSetUsed()Returns whether the complete rule set is used.- Returns:
- 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. False by default.
-
setCompleteRuleSetUsed
public void setCompleteRuleSetUsed(boolean completeRuleSetUsed) Sets whether Zhang's complete rule set is 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. False by default.
-
getMaxDiscriminatingPathLength
public int getMaxDiscriminatingPathLength()Returns the maximum length of any discriminating path, or -1 of unlimited.- Returns:
- This length.
-
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.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output is printed.- Parameters:
verbose
- True, if so.
-
getIndependenceTest
Returns the independence test used in search.- Returns:
- This test.
-
setOut
Sets the output stream used to print. Unused, but the implementation needs to be here.- Parameters:
out
- This print stream.
-
setDepth
public void setDepth(int depth) Sets the maximum number of variables conditioned on.- Parameters:
depth
- This maximum.
-
setGuaranteePag
public void setGuaranteePag(boolean guaranteePag) Sets whether the search should guarantee the output is a legal PAG.- Parameters:
guaranteePag
- True, if so.
-
setSepsetFinderMethod
public void setSepsetFinderMethod(int sepsetFinderMethod) Sets the method to use for finding sepsets, 1 = greedy, 2 = min-p., 3 = max-p, default min-p.- Parameters:
sepsetFinderMethod
- the method to use for finding sepsets
-