use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class IonRunner method execute.
// =================PUBLIC METHODS OVERRIDING ABSTRACT=================//
/**
* Executes the algorithm, producing (at least) a result workbench. Must be
* implemented in the extending class.
*/
public void execute() {
System.out.println("Executing.");
IonJoeModifications ion = new IonJoeModifications(getGraphs());
ion.setAdjacencySearch(getParams().getBoolean("pruneByAdjacencies", true));
ion.setPathLengthSearch(getParams().getBoolean("pruneByPathLength", true));
ion.setKnowledge((IKnowledge) getParams().get("knowledge", new Knowledge2()));
List<Graph> graphs = ion.search();
Collections.sort(graphs, new Comparator<Graph>() {
public int compare(Graph graph, Graph graph1) {
return graph.getNumEdges() - graph1.getNumEdges();
}
});
if (graphs == null) {
throw new NullPointerException();
}
if (!graphs.isEmpty()) {
setResultGraph(graphs.get(0));
}
System.out.println("graphs = " + graphs);
getParams().set("graphIndex", 0);
this.graphs = graphs;
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class KpcRunner 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 MbFanSearchRunner method execute.
// =================PUBLIC METHODS OVERRIDING ABSTRACT=================//
/**
* Executes the algorithm, producing (at least) a result workbench. Must be
* implemented in the extending class.
*/
public void execute() {
int pcDepth = getParams().getInt("depth", -1);
Mbfs mbfs = new Mbfs(getIndependenceTest(), pcDepth);
Parameters params = getParams();
if (params instanceof Parameters) {
mbfs.setAggressivelyPreventCycles(params.getBoolean("aggressivelyPreventCycles", false));
}
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
mbfs.setKnowledge(knowledge);
String targetName = getParams().getString("targetName", null);
Graph graph = mbfs.search(targetName);
setResultGraph(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else if (knowledge.isDefaultToKnowledgeLayout()) {
SearchGraphUtils.arrangeByKnowledgeTiers(graph, knowledge);
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
this.mbfs = mbfs;
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class MbfsRunner method execute.
// =================PUBLIC METHODS OVERRIDING ABSTRACT=================//
/**
* Executes the algorithm, producing (at least) a result workbench. Must be
* implemented in the extending class.
*/
public void execute() {
// int pcDepth = ((Parameters) getParameters()).getMaxIndegree();
// Mbfs mbfs = new Mbfs(getIndependenceTest(), pcDepth);
// Parameters params = getParameters();
// if (params instanceof Parameters) {
// mbfs.setAggressivelyPreventCycles(((Parameters) params)
// .isAggressivelyPreventCycles());
// }
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
// mbfs.setKnowledge(knowledge);
String targetName = getParams().getString("targetName", null);
// Graph searchGraph = mbfs.search(targetName);
// setResultGraph(searchGraph);
DataSet dataSet = (DataSet) getDataModelList().get(0);
SemBicScore score = new SemBicScore(new CovarianceMatrixOnTheFly(dataSet));
score.setPenaltyDiscount(getParams().getDouble("alpha", 0.001));
FgesMb search = new FgesMb(score);
search.setFaithfulnessAssumed(true);
Graph searchGraph = search.search(dataSet.getVariable(targetName));
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(searchGraph, getSourceGraph());
} else if (knowledge.isDefaultToKnowledgeLayout()) {
SearchGraphUtils.arrangeByKnowledgeTiers(searchGraph, knowledge);
} else {
GraphUtils.circleLayout(searchGraph, 200, 200, 150);
}
// this.mbfs = mbfs;
setResultGraph(searchGraph);
}
use of edu.cmu.tetrad.data.Knowledge2 in project tetrad by cmu-phil.
the class MmhcRunner method getMeekRules.
public ImpliedOrientation getMeekRules() {
MeekRules rules = new MeekRules();
rules.setKnowledge((IKnowledge) getParams().get("knowledge", new Knowledge2()));
return rules;
}
Aggregations