Package edu.cmu.tetrad.search
Class FgesMb
java.lang.Object
edu.cmu.tetrad.search.FgesMb
Restricts the FGES algorithm (see) to the operations needed just to find the graph over the Markov blanket of a variable X (or a graph over the Markov blankets of a list of variables X1,..,Xn), together with the target X (or, respectively, the targets X1,...,Xn). The reference is this:
Ramsey, J., Glymour, M., Sanchez-Romero, R., & Glymour, C. (2017). A million variables and more: the fast greedy equivalence search algorithm for learning high-dimensional graphical causal models, with an application to functional magnetic resonance images. International journal of data science and analytics, 3, 121-129.
This class is configured to respect knowledge of forbidden and required edges, including knowledge of temporal tiers.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the elapsed time of the search.Returns the background knowledge.int
The maximum of parents any nodes can have in output CPDAG.int
getMinChunk
(int n) int
Returns the number of CPDAGs to store.double
Returns the totalScore of the given DAG, up to a constant.Returns the list of top scoring graphs.double
Scores the given DAG, up to a constant.Greedy equivalence search: Start from the empty graph, add edges till model is significant.Searches over a specific list of target variables.void
setAdjacencies
(Graph adjacencies) Sets the graph of preset adjacenies for the algorithm; edges not in this adjacencies graph will not be added.void
setCycleBound
(int cycleBound) A bound on cycle length.void
setExternalGraph
(Graph externalGraph) Sets the external graph.void
setFaithfulnessAssumed
(boolean faithfulnessAssumed) Set to true if it is assumed that all path pairs with one length 1 path do not cancel.void
setKnowledge
(Knowledge knowledge) Sets the background knowledge.void
setMaxDegree
(int maxDegree) The maximum of parents any nodes can have in output CPDAG.void
setNumCpdagsToStore
(int numCpdagsToStore) Sets the number of CPDAGs to store.void
setOut
(PrintStream out) Sets the output stream that output (except for log output) should be sent to.void
setParallelized
(boolean parallelized) Creates a new processors pool with the specified number of threads.void
setTrueGraph
(Graph trueGraph) If the true graph is set, askterisks will be printed in log output for the true edges.void
setVerbose
(boolean verbose) Sets whether verbose output should be produced.
-
Constructor Details
-
FgesMb
Constructor. Construct a Score and pass it in here. The totalScore should return a positive value in case of conditional dependence and a negative values in case of conditional independence. See Chickering (2002), locally consistent scoring criterion.
-
-
Method Details
-
setFaithfulnessAssumed
public void setFaithfulnessAssumed(boolean faithfulnessAssumed) Set to true if it is assumed that all path pairs with one length 1 path do not cancel.- Parameters:
faithfulnessAssumed
- True if so.- See Also:
-
search
Greedy equivalence search: Start from the empty graph, add edges till model is significant. Then start deleting edges till a minimum is achieved.- Returns:
- the resulting CPDAG.
-
search
Searches over a specific list of target variables.- Parameters:
targets
- The targets.- Returns:
- The union of the edges for the Markov blanekt graph for each target.
-
getKnowledge
Returns the background knowledge.- Returns:
- This knowledge.
-
setKnowledge
Sets the background knowledge.- Parameters:
knowledge
- the knowledge object, specifying forbidden and required edges.
-
getElapsedTime
public long getElapsedTime()Returns the elapsed time of the search.- Returns:
- This time.
-
setTrueGraph
If the true graph is set, askterisks will be printed in log output for the true edges.- Parameters:
trueGraph
- The true graph.
-
getScore
Returns the totalScore of the given DAG, up to a constant.- Parameters:
dag
- The dag to score.- Returns:
- The scre of the DAG.
-
getTopGraphs
Returns the list of top scoring graphs.- Returns:
- The top scoring graphs.
-
getnumCPDAGsToStore
public int getnumCPDAGsToStore()Returns the number of CPDAGs to store.- Returns:
- This number.
-
setNumCpdagsToStore
public void setNumCpdagsToStore(int numCpdagsToStore) Sets the number of CPDAGs to store. This should be set to zero for fast search.- Parameters:
numCpdagsToStore
- This number.
-
setExternalGraph
Sets the external graph. The search graph is initialized to this. -
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output should be produced.- Parameters:
verbose
- True if so.
-
setOut
Sets the output stream that output (except for log output) should be sent to. By detault System.out.- Parameters:
out
- The output print stream, by default System.out.
-
setAdjacencies
Sets the graph of preset adjacenies for the algorithm; edges not in this adjacencies graph will not be added.- Parameters:
adjacencies
- This graph.
-
setCycleBound
public void setCycleBound(int cycleBound) A bound on cycle length.- Parameters:
cycleBound
- The bound, ≥ 1, or -1 for unlimited.
-
setParallelized
public void setParallelized(boolean parallelized) Creates a new processors pool with the specified number of threads.- Parameters:
parallelized
- True if parallelized,
-
getMaxDegree
public int getMaxDegree()The maximum of parents any nodes can have in output CPDAG.- Returns:
- -1 for unlimited.
-
setMaxDegree
public void setMaxDegree(int maxDegree) The maximum of parents any nodes can have in output CPDAG.- Parameters:
maxDegree
- -1 for unlimited.
-
getMinChunk
public int getMinChunk(int n) -
scoreDag
Scores the given DAG, up to a constant.
-