use of edu.cmu.tetrad.graph.Node in project tetrad by cmu-phil.
the class FciOrientT method addColliders.
private void addColliders(Graph graph, final SepsetProducer sepsetProducer, IKnowledge knowledge) {
List<Triple> colliders = findCollidersUsingSepsets(sepsetProducer, graph, verbose);
for (Triple collider : colliders) {
Node a = collider.getX();
Node b = collider.getY();
Node c = collider.getZ();
if (!(isArrowpointAllowed(a, b, graph) && isArrowpointAllowed(c, b, graph))) {
continue;
}
graph.setEndpoint(a, b, Endpoint.ARROW);
graph.setEndpoint(c, b, Endpoint.ARROW);
}
}
use of edu.cmu.tetrad.graph.Node in project tetrad by cmu-phil.
the class IndTestDirichletScore method indTestSubset.
// ==========================PUBLIC METHODS=============================//
/**
* Creates a new independence test instance for a subset of the variables.
*/
public IndependenceTest indTestSubset(List<Node> vars) {
if (vars.isEmpty()) {
throw new IllegalArgumentException("Subset may not be empty.");
}
for (Node var : vars) {
if (!variables.contains(var)) {
throw new IllegalArgumentException("All vars must be original vars");
}
}
int[] indices = new int[vars.size()];
for (int i = 0; i < indices.length; i++) {
indices[i] = indexMap.get(vars.get(i));
}
DataSet newDataSet = dataSet.subsetColumns(indices);
return new IndTestDirichletScore(newDataSet, getSamplePrior(), getStructurePrior());
}
use of edu.cmu.tetrad.graph.Node in project tetrad by cmu-phil.
the class IndTestDirichletScore method getVariableNames.
/**
* @return the list of variable varNames.
*/
public List<String> getVariableNames() {
List<Node> variables = getVariables();
List<String> variableNames = new ArrayList<>();
for (Node variable1 : variables) {
variableNames.add(variable1.getName());
}
return variableNames;
}
use of edu.cmu.tetrad.graph.Node in project tetrad by cmu-phil.
the class IndTestFisherZ method getVariableNames.
/**
* @return the list of variable varNames.
*/
public List<String> getVariableNames() {
List<Node> variables = getVariables();
List<String> variableNames = new ArrayList<>();
for (Node variable1 : variables) {
variableNames.add(variable1.getName());
}
return variableNames;
}
use of edu.cmu.tetrad.graph.Node in project tetrad by cmu-phil.
the class IndTestFisherZ method indTestSubset.
// ==========================PUBLIC METHODS=============================//
/**
* Creates a new independence test instance for a subset of the variables.
*/
public IndependenceTest indTestSubset(List<Node> vars) {
if (vars.isEmpty()) {
throw new IllegalArgumentException("Subset may not be empty.");
}
for (Node var : vars) {
if (!variables.contains(var)) {
throw new IllegalArgumentException("All vars must be original vars");
}
}
int[] indices = new int[vars.size()];
for (int i = 0; i < indices.length; i++) {
indices[i] = indexMap.get(vars.get(i));
}
ICovarianceMatrix newCovMatrix = covMatrix.getSubmatrix(indices);
double alphaNew = getAlpha();
return new IndTestFisherZ(newCovMatrix, alphaNew);
}
Aggregations