Class FgesMb

java.lang.Object
edu.cmu.tetrad.search.FgesMb

public final class FgesMb extends Object

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 Details

    • FgesMb

      public FgesMb(Score score)
      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

      public Graph search(Node target)
      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

      public Graph search(List<Node> targets)
      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

      public Knowledge getKnowledge()
      Returns the background knowledge.
      Returns:
      This knowledge.
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      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

      public void setTrueGraph(Graph trueGraph)
      If the true graph is set, askterisks will be printed in log output for the true edges.
      Parameters:
      trueGraph - The true graph.
    • getScore

      public double getScore(Graph dag)
      Returns the totalScore of the given DAG, up to a constant.
      Parameters:
      dag - The dag to score.
      Returns:
      The scre of the DAG.
    • getTopGraphs

      public LinkedList<ScoredGraph> 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

      public void setExternalGraph(Graph externalGraph)
      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

      public void setOut(PrintStream out)
      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

      public void setAdjacencies(Graph adjacencies)
      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

      public double scoreDag(Graph dag)
      Scores the given DAG, up to a constant.