use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class TestCpc method testSearch3.
/**
* This will fail if the orientation loop doesn't continue after the first orientation.
*/
@Test
public void testSearch3() {
IKnowledge knowledge = new Knowledge2();
knowledge.setForbidden("B", "D");
knowledge.setForbidden("D", "B");
knowledge.setForbidden("C", "B");
checkWithKnowledge("A-->B,C-->B,B-->D", "A---B,B-->C,D", /*"A-->B,C-->B,A-->D,C-->D",*/
knowledge);
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class GlassoRunner method getMeekRules.
public ImpliedOrientation getMeekRules() {
MeekRules rules = new MeekRules();
rules.setAggressivelyPreventCycles(this.isAggressivelyPreventCycles());
rules.setKnowledge((IKnowledge) getParams().get("knowledge", new Knowledge2()));
return rules;
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class KpcRunner method execute.
// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
int depth = getParams().getInt("depth", -1);
// Cpci pcSearch = new Cpci(getIndependenceTest(), knowledge, getIndependenceTest().getSimulatedData());
Kpc kpc = new Kpc((DataSet) getDataModel(), getParams().getDouble("alpha", 0.001));
kpc.setKnowledge(knowledge);
kpc.setAggressivelyPreventCycles(isAggressivelyPreventCycles());
kpc.setDepth(depth);
Graph graph = kpc.search();
System.out.println(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else if (knowledge.isDefaultToKnowledgeLayout()) {
SearchGraphUtils.arrangeByKnowledgeTiers(graph, knowledge);
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
setResultGraph(graph);
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class MmhcRunner method execute.
// ============================PUBLIC METHODS==========================//
/**
* Executes the algorithm, producing (at least) a result workbench. Must be
* implemented in the extending class.
*/
public void execute() {
Mmhc search;
int depth = getParams().getInt("depth", -1);
search = new Mmhc(getIndependenceTest(), getIndependenceTest().getDataSets().get(0));
search.setDepth(depth);
search.setKnowledge((IKnowledge) getParams().get("knowledge", new Knowledge2()));
Graph graph = search.search();
setResultGraph(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class FasRunner method execute.
// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
int depth = getParams().getInt("depth", -1);
Graph graph = new EdgeListGraph(getIndependenceTest().getVariables());
Fas fas = new Fas(graph, getIndependenceTest());
fas.setKnowledge(knowledge);
fas.setDepth(depth);
graph = fas.search();
System.out.println(graph);
for (Node node : graph.getNodes()) {
System.out.println(node + " " + graph.getAdjacentNodes(node).size());
}
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else if (knowledge.isDefaultToKnowledgeLayout()) {
SearchGraphUtils.arrangeByKnowledgeTiers(graph, knowledge);
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
setResultGraph(graph);
}
Aggregations