Class Ccd
- All Implemented Interfaces:
IGraphSearch
Richardson, T. S. (2013). A discovery algorithm for directed cyclic graphs. arXiv:1302.3599.
See also Chapter 7 of: Glymour & Cooper (1999), Computation, Causation, and Discovery.
Input: a conditional independence oracle/test for data from a directed cyclic model (DCG). Output: a cyclic PAG (with underline/dotted-underline annotations) representing the Markov equivalence class.
Note: Background knowledge is supported as forbidden directed edges only. Required edges are intentionally ignored (and should not be supplied) to avoid forcing orientations not justified by CCD.
-
Constructor Summary
ConstructorsConstructorDescriptionCcd(IndependenceTest test) Constructs a Ccd object with the given independence test. -
Method Summary
Modifier and TypeMethodDescriptiongetTest()Retrieves the current independence test being used.booleanDetermines whether the R1 orientation rule is set to be applied during the search process.search()Executes the CCD search algorithm to infer a causal graph based on statistical independence tests.voidsetApplyR1(boolean applyR1) Sets whether the R1 orientation rule should be applied during the search process.voidsetDepth(int depth) Sets the depth parameter, which may affect the algorithm's behavior during its operation.voidsetKnowledge(Knowledge knowledge) Set background knowledge (forbidden edges).voidsetTest(IndependenceTest test) Sets the independence test to be used during the algorithm's execution.voidsetVerbose(boolean verbose) Sets whether verbose output should be enabled for the current process.
-
Constructor Details
-
Ccd
Constructs a Ccd object with the given independence test.- Parameters:
test- the IndependenceTest to be used within the CCD algorithm. If the test is not an instance ofCachingIndependenceTest, a caching wrapper will be applied to the provided test. Must not be null.- Throws:
NullPointerException- if the provided test is null.
-
-
Method Details
-
search
Executes the CCD search algorithm to infer a causal graph based on statistical independence tests. The algorithm applies a series of steps, including adjacency search, orientation rules, and edge propagation, while taking into account background knowledge (if provided) and specific algorithm configurations (e.g., depth). A verbose logging option is available for detailed execution monitoring.The resulting graph is modified with orientations and additional structures based on statistical properties and algorithmic rules. These modifications include reoriented endpoints, the addition of non-collider and collider triples, and propagation of orientation changes to ensure consistency with the underlying causal structure. A final step attempts to direct edges where permissible according to the background knowledge.
- Specified by:
searchin interfaceIGraphSearch- Returns:
- the inferred causal graph as a
Graphobject after applying the CCD search algorithm. - Throws:
InterruptedException- if the process is interrupted during execution.
-
getTest
Retrieves the current independence test being used.- Specified by:
getTestin interfaceIGraphSearch- Returns:
- the current IndependenceTest instance.
-
setTest
Sets the independence test to be used during the algorithm's execution. The provided test must have the same variable set as the current test. A caching wrapper will be applied to the test if it is not already cached.- Specified by:
setTestin interfaceIGraphSearch- Parameters:
test- the new independence test to be set. Must not be null and must have the same variable set as the existing test.- Throws:
NullPointerException- if the provided test is null.IllegalArgumentException- if the variable set of the new test differs from the variable set of the current test.
-
isApplyR1
public boolean isApplyR1()Determines whether the R1 orientation rule is set to be applied during the search process.- Returns:
- true if the R1 orientation rule is enabled; false otherwise.
-
setApplyR1
public void setApplyR1(boolean applyR1) Sets whether the R1 orientation rule should be applied during the search process.- Parameters:
applyR1- a boolean indicating whether to apply the R1 rule. If true, the R1 rule will be applied; otherwise, it will not.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether verbose output should be enabled for the current process.- Parameters:
verbose- a boolean indicating whether verbose output is enabled. If true, detailed logs or messages may be printed. If false, minimal or no verbose output will be shown.
-
setDepth
public void setDepth(int depth) Sets the depth parameter, which may affect the algorithm's behavior during its operation.- Parameters:
depth- an integer representing the depth limit or level of recursion to be applied. A higher value typically increases the scope or complexity taken into account.
-
setKnowledge
Set background knowledge (forbidden edges). Required edges are not supported.- Parameters:
knowledge- the knowledge to be set
-