Class SpFci

java.lang.Object
edu.cmu.tetrad.search.SpFci
All Implemented Interfaces:
IGraphSearch

public final class SpFci extends Object implements IGraphSearch

Uses SP in place of FGES for the initial step in the GFCI algorithm. This tends to produce a accurate PAG than GFCI as a result, for the latent variables case. This is a simple substitution; the reference for GFCI is here:

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.

Author:
josephramsey, bryan andrews
See Also:
  • Constructor Details

    • SpFci

      public SpFci(IndependenceTest test, Score score)
      Constructor; requires by ta test and a score, over the same variables.
      Parameters:
      test - The test.
      score - The score.
  • Method Details

    • search

      public Graph search()
      Runs the search and returns the discovered PAG.
      Specified by:
      search in interface IGraphSearch
      Returns:
      This PAG.
    • 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

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

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

      public int getMaxPathLength()
      Returns the maximum length of any discriminating path, or -1 of unlimited.
      Returns:
      This length.
    • setMaxPathLength

      public void setMaxPathLength(int maxPathLength)
      Sets the max path length for discriminating paths.
      Parameters:
      maxPathLength - 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

      public IndependenceTest getIndependenceTest()
      Returns the independence test used in search.
      Returns:
      This test.
    • setOut

      public void setOut(PrintStream out)
      Sets the output stream used to print.
      Parameters:
      out - This print stream.
    • setDepth

      public void setDepth(int depth)
      Sets the maximum number of variables conditioned on.
      Parameters:
      depth - This maximum.
    • setDoDiscriminatingPathRule

      public void setDoDiscriminatingPathRule(boolean doDiscriminatingPathRule)
      Sets whether the discriminating path search is done.
      Parameters:
      doDiscriminatingPathRule - True, if so.