use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class CeFanSearchRunner 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);
Cefs search = new Cefs(getIndependenceTest(), pcDepth);
Parameters params = getParams();
if (params instanceof Parameters) {
search.setAggressivelyPreventCycles(params.getBoolean("aggressivelyPreventCycles", false));
}
String targetName = getParams().getString("targetName", null);
Graph graph = search.search(targetName);
setResultGraph(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else if (((IKnowledge) getParams().get("knowledge", new Knowledge2())).isDefaultToKnowledgeLayout()) {
SearchGraphUtils.arrangeByKnowledgeTiers(graph, (IKnowledge) getParams().get("knowledge", new Knowledge2()));
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class CpcLocalRunner method execute.
// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
IndependenceTest independenceTest = getIndependenceTest();
Parameters testParams = getParams();
CpcLocal search = new CpcLocal(independenceTest);
search.setAggressivelyPreventCycles(isAggressivelyPreventCycles());
search.setKnowledge(knowledge);
Graph graph = search.search();
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.util.Parameters in project tetrad by cmu-phil.
the class InverseCorrelationRunner method execute.
// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
Object dataModel = getDataModel();
if (dataModel instanceof DataSet) {
DataSet dataSet = (DataSet) dataModel;
Parameters params = getParams();
InverseCorrelation search = new InverseCorrelation(dataSet, params.getDouble("thr", 1e-4));
Graph graph = search.search();
setResultGraph(graph);
}
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class Save method main.
public static void main(String... args) {
Parameters parameters = new Parameters();
parameters.set("numRuns", 10);
parameters.set("numMeasures", 50, 100);
parameters.set("avgDegree", 4);
parameters.set("sampleSize", 100, 500);
parameters.set("numCategories", 3);
parameters.set("percentDiscrete", 50);
parameters.set("differentGraphs", true);
Simulation simulation = new LeeHastieSimulation(new RandomForward());
Comparison comparison = new Comparison();
comparison.setShowAlgorithmIndices(true);
comparison.saveToFiles("comparison", simulation, parameters);
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class AbstractSearchEditor method storeLatestWorkbenchGraph.
void storeLatestWorkbenchGraph() {
Graph latestWorkbenchGraph = workbench.getGraph();
if (latestWorkbenchGraph.getNumNodes() == 0) {
return;
}
Parameters searchParams = algorithmRunner.getParams();
try {
Graph graph = new MarshalledObject<>(latestWorkbenchGraph).get();
if (graph == null) {
throw new NullPointerException("Null graph");
}
if (searchParams != null) {
searchParams.set("sourceGraph", graph);
}
} catch (IOException e) {
e.printStackTrace();
if (searchParams != null) {
searchParams.set("sourceGraph", (Graph) null);
}
} catch (ClassNotFoundException e) {
if (searchParams != null) {
searchParams.set("sourceGraph", (Graph) null);
}
e.printStackTrace();
}
}
Aggregations