Package edu.cmu.tetrad.search
Class Pcd
java.lang.Object
edu.cmu.tetrad.search.Pcd
- All Implemented Interfaces:
IGraphSearch
Modifies the PC algorithm to handle the deterministic case. Edges removals or orientations based on conditional independence test involving deterministic relationships are not done.
This class is configured to respect knowledge of forbidden and required edges, including knowledge of temporal tiers.
-
Constructor Summary
ConstructorsConstructorDescriptionPcd
(IndependenceTest independenceTest) Constructs a new PC search using the given independence test as oracle. -
Method Summary
Modifier and TypeMethodDescriptionint
getDepth()
long
getNodes()
int
boolean
isFdr()
True iff the algorithm should be run with False Discovery Rate tests.boolean
boolean
search()
Runs PC starting with a complete graph over all nodes of the given conditional independence test, using the given independence test and knowledge and returns the resultant graph.Runs PC starting with a complete graph over the given list of nodes, using the given independence test and knowledge and returns the resultant graph.void
setDepth
(int depth) Sets the depth of the search--that is, the maximum number of conditioning nodes for any conditional independence checked.void
setFdr
(boolean fdr) void
setKnowledge
(Knowledge knowledge) Sets the knowledge specification to be used in the search.void
setMeekPreventCycles
(boolean meekPreventCycles) void
setVerbose
(boolean verbose)
-
Constructor Details
-
Pcd
Constructs a new PC search using the given independence test as oracle.- Parameters:
independenceTest
- The oracle for conditional independence facts. This does not make a copy of the independence test, for fear of duplicating the data set!
-
-
Method Details
-
isMeekPreventCycles
public boolean isMeekPreventCycles()- Returns:
- true, iff edges will not be added if they would create cycles.
-
setMeekPreventCycles
public void setMeekPreventCycles(boolean meekPreventCycles) - Parameters:
meekPreventCycles
- Set to true just in case edges will not be added if they would create cycles.
-
getIndependenceTest
- Returns:
- the independence test being used in the search.
-
getKnowledge
- Returns:
- the knowledge specification used in the search. Non-null.
-
setKnowledge
Sets the knowledge specification to be used in the search. May not be null. -
getSepsets
- Returns:
- the sepset map from the most recent search. Non-null after the first call to
search()
.
-
getDepth
public int getDepth()- Returns:
- the current depth of search--that is, the maximum number of conditioning nodes for any conditional independence checked.
-
setDepth
public void setDepth(int depth) Sets the depth of the search--that is, the maximum number of conditioning nodes for any conditional independence checked.- Parameters:
depth
- The depth of the search. The default is 1000. A value of -1 may be used to indicate that the depth should be high (1000). A value of Integer.MAX_VALUE may not be used due to a bug on multicore machines.
-
search
Runs PC starting with a complete graph over all nodes of the given conditional independence test, using the given independence test and knowledge and returns the resultant graph. The returned graph will be a CPDAG if the independence information is consistent with the hypothesis that there are no latent common causes. It may, however, contain cycles or bidirected edges if this assumption is not born out, either due to the actual presence of latent common causes, or due to statistical errors in conditional independence judgments.- Specified by:
search
in interfaceIGraphSearch
- Returns:
- The discovered graph.
-
search
Runs PC starting with a complete graph over the given list of nodes, using the given independence test and knowledge and returns the resultant graph. The returned graph will be a CPDAG if the independence information is consistent with the hypothesis that there are no latent common causes. It may, however, contain cycles or bidirected edges if this assumption is not born out, either due to the actual presence of latent common causes, or due to statistical errors in conditional independence judgments.All the given nodes must be in the domain of the given conditional independence test.
-
search
-
getElapsedTime
public long getElapsedTime()- Returns:
- the elapsed time of the search, in milliseconds.
-
getUnshieldedColliders
- Returns:
- the set of unshielded colliders in the graph returned by
search()
. Non-null aftersearch
is called.
-
getUnshieldedNoncolliders
- Returns:
- the set of unshielded noncolliders in the graph returned by
search()
. Non-null aftersearch
is called.
-
getAdjacencies
-
getNumIndependenceTests
public int getNumIndependenceTests() -
getNodes
-
isVerbose
public boolean isVerbose() -
setVerbose
public void setVerbose(boolean verbose) -
isFdr
public boolean isFdr()True iff the algorithm should be run with False Discovery Rate tests. -
setFdr
public void setFdr(boolean fdr)
-