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.
- Version:
- $Id: $Id
- Author:
- peterspirtes, josephramsey.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPcd
(IndependenceTest independenceTest) Constructs a new PC search using the given independence test as oracle. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of adjacent edges in the graph.int
getDepth()
Getter for the fielddepth
.long
Returns the elapsed time in milliseconds since the start of the method.Retrieves the IndependenceTest used by this method.Retrieves the Knowledge object used by this method.getNodes()
Retrieves the list of nodes in the graph.int
Retrieves the number of independence tests performed by the graph search.Getter for the fieldsepsets
.Retrieves the set of unshielded colliders in the graph returned by the method search().Retrieves the set of unshielded noncolliders in the graph returned by the method search().boolean
isFdr()
True iff the algorithm should be run with False Discovery Rate tests.boolean
Returns whether the algorithm should prevent cycles during the search.boolean
True iff the algorithm should be run with verbose output.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.Searches for a graph using the given IFas instance and list of nodes.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) Sets whether this test will run with False Discovery Rate tests.void
setGuaranteeCpdag
(boolean guaranteeCpdag) Sets whether the algorithm should prevent cycles during the search.void
setKnowledge
(Knowledge knowledge) Sets the knowledge object used by this method.void
setVerbose
(boolean verbose) Sets whether this test will print verbose output.
-
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
-
isGuaranteeCpdag
public boolean isGuaranteeCpdag()Returns whether the algorithm should prevent cycles during the search.- Returns:
- true if cycles should be prevented, false otherwise.
-
setGuaranteeCpdag
public void setGuaranteeCpdag(boolean guaranteeCpdag) Sets whether the algorithm should prevent cycles during the search.- Parameters:
guaranteeCpdag
- true if cycles should be prevented, false otherwise
-
getIndependenceTest
Retrieves the IndependenceTest used by this method.- Returns:
- The IndependenceTest used by this method.
-
getKnowledge
Retrieves the Knowledge object used by this method.- Returns:
- The Knowledge object used by this method.
-
setKnowledge
Sets the knowledge object used by this method.- Parameters:
knowledge
- The knowledge object used by this method.- Throws:
NullPointerException
- if knowledge is null.
-
getSepsets
Getter for the field
sepsets
.- Returns:
- the sepset map from the most recent search. Non-null after the first call to
search()
.
-
getDepth
public int getDepth()Getter for the field
depth
.- 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:
- a
Graph
object - Throws:
InterruptedException
- if any.
-
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.
- Parameters:
nodes
- aList
object- Returns:
- a
Graph
object - Throws:
InterruptedException
-
search
Searches for a graph using the given IFas instance and list of nodes.- Parameters:
fas
- The IFas instance to use for the search.nodes
- The list of nodes to search for.- 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.
- Throws:
NullPointerException
- If fas is null or if the independence test is null.IllegalArgumentException
- If any of the given nodes is not in the domain of the independence test provided.InterruptedException
-
getElapsedTime
public long getElapsedTime()Returns the elapsed time in milliseconds since the start of the method.- Returns:
- the elapsed time in milliseconds
-
getUnshieldedColliders
-
getUnshieldedNoncolliders
-
getAdjacencies
-
getNumIndependenceTests
public int getNumIndependenceTests()Retrieves the number of independence tests performed by the graph search.- Returns:
- The number of independence tests performed.
-
getNodes
-
isVerbose
public boolean isVerbose()True iff the algorithm should be run with verbose output.- Returns:
- True, if so.
-
setVerbose
public void setVerbose(boolean verbose) Sets whether this test will print verbose output.- Parameters:
verbose
- True, if so.
-
isFdr
public boolean isFdr()True iff the algorithm should be run with False Discovery Rate tests.- Returns:
- True, if so.
-
setFdr
public void setFdr(boolean fdr) Sets whether this test will run with False Discovery Rate tests.- Parameters:
fdr
- True, if so.
-