Package edu.cmu.tetrad.search.utils
Class SepsetsMinP
java.lang.Object
edu.cmu.tetrad.search.utils.SepsetsMinP
- All Implemented Interfaces:
SepsetProducer
The SepsetsMinP class is a concrete implementation of the SepsetProducer interface. It calculates the separating sets
(sepsets) between nodes in a given graph using a minimum p-value approach. The sepsets are calculated based on an
independence test provided to the class.
This class tries to minimize the p-value of the independence test result when selecting sepsets.
-
Constructor Summary
ConstructorsConstructorDescriptionSepsetsMinP
(Graph graph, IndependenceTest independenceTest, int depth) Initializes a new instance of the SepsetsMinP class. -
Method Summary
Modifier and TypeMethodDescriptiongetDag()
Retrieves the Directed Acyclic Graph (DAG) produced by the Sepsets algorithm.double
Returns the p-value for the independence test between two nodes, given a set of separator nodes.double
getScore()
Calculates the score for the given Sepsets object.Retrieves the sepset (separating set) between two nodes, or null if no such sepset is found.getSepsetContaining
(Node i, Node k, Set<Node> s, int depth) Retrieves a sepset (separating set) between two nodes containing a set of nodes containing the nodes in s, or null if no such sepset is found.Retrieves the variables used in the independence test.boolean
isIndependent
(Node a, Node b, Set<Node> sepset) Determines if two nodes are independent given a set of separating nodes.boolean
isUnshieldedCollider
(Node i, Node j, Node k, int depth) Checks if a given collider node is unshielded between two other nodes.boolean
Returns whether the object is in verbose mode.void
Sets the graph for the Sepsets object.void
setVerbose
(boolean verbose) Sets the verbosity level for this object.
-
Constructor Details
-
SepsetsMinP
Initializes a new instance of the SepsetsMinP class.- Parameters:
graph
- The graph to set.independenceTest
- The independence test used for calculating sepsets.depth
- The depth of the sepsets search algorithm.
-
-
Method Details
-
getSepset
Retrieves the sepset (separating set) between two nodes, or null if no such sepset is found.- Specified by:
getSepset
in interfaceSepsetProducer
- Parameters:
i
- The first nodek
- The second nodedepth
- The depth of the search- Returns:
- The sepset between the two nodes
- Throws:
InterruptedException
-
getSepsetContaining
public Set<Node> getSepsetContaining(Node i, Node k, Set<Node> s, int depth) throws InterruptedException Retrieves a sepset (separating set) between two nodes containing a set of nodes containing the nodes in s, or null if no such sepset is found. If there is no required set of nodes, pass null for the set.- Specified by:
getSepsetContaining
in interfaceSepsetProducer
- Parameters:
i
- The first nodek
- The second nodes
- The set of nodes that must be contained in the sepset, or null if no such set is required.depth
- The depth of the search- Returns:
- The sepset between the two nodes
- Throws:
InterruptedException
-
isUnshieldedCollider
Checks if a given collider node is unshielded between two other nodes.- Specified by:
isUnshieldedCollider
in interfaceSepsetProducer
- Parameters:
i
- The first node.j
- The collider node.k
- The second node.depth
- The depth of the search.- Returns:
- true if the collider node is unshielded between the two nodes, false otherwise.
- Throws:
InterruptedException
-
isIndependent
Determines if two nodes are independent given a set of separating nodes.- Specified by:
isIndependent
in interfaceSepsetProducer
- Parameters:
a
- The first node.b
- The second node.sepset
- The set of separating nodes.- Returns:
- true if the two nodes are independent, false otherwise.
- Throws:
InterruptedException
-
getPValue
Returns the p-value for the independence test between two nodes, given a set of separator nodes.- Specified by:
getPValue
in interfaceSepsetProducer
- Parameters:
a
- the first nodeb
- the second nodesepset
- the set of separator nodes- Returns:
- the p-value for the independence test
- Throws:
InterruptedException
-
setGraph
Sets the graph for the Sepsets object.- Specified by:
setGraph
in interfaceSepsetProducer
- Parameters:
graph
- The graph to set.
-
getScore
public double getScore()Calculates the score for the given Sepsets object.- Specified by:
getScore
in interfaceSepsetProducer
- Returns:
- The score calculated based on the result's p-value and the independence test's alpha value.
-
getVariables
Retrieves the variables used in the independence test.- Specified by:
getVariables
in interfaceSepsetProducer
- Returns:
- A list of Node objects representing the variables used in the independence test.
-
isVerbose
public boolean isVerbose()Returns whether the object is in verbose mode.- Returns:
- true if the object is in verbose mode, false otherwise
-
setVerbose
public void setVerbose(boolean verbose) Sets the verbosity level for this object. When verbose mode is set to true, additional debugging information will be printed during the execution of this method.- Specified by:
setVerbose
in interfaceSepsetProducer
- Parameters:
verbose
- The verbosity level to set. Set to true for verbose output, false otherwise.
-
getDag
Retrieves the Directed Acyclic Graph (DAG) produced by the Sepsets algorithm.- Returns:
- The DAG produced by the Sepsets algorithm, or null if the independence test is not an instance of MsepTest.
-