use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class SemEstimatorWrapper method serializableInstance.
// public SemEstimatorWrapper(DataWrapper dataWrapper,
// SemPmWrapper semPmWrapper,
// SemImWrapper semImWrapper,
// Parameters params) {
// if (dataWrapper == null) {
// throw new NullPointerException();
// }
//
// if (semPmWrapper == null) {
// throw new NullPointerException();
// }
//
// if (semImWrapper == null) {
// throw new NullPointerException();
// }
//
// DataSet dataSet =
// (DataSet) dataWrapper.getSelectedDataModel();
// SemPm semPm = semPmWrapper.getSemPm();
// SemIm semIm = semImWrapper.getSemIm();
//
// this.semEstimator = new SemEstimator(dataSet, semPm, getOptimizer());
// if (!degreesOfFreedomCheck(semPm)) return;
// this.semEstimator.setTrueSemIm(semIm);
// this.semEstimator.setNumRestarts(getParams().getInt("numRestarts", 1));
// this.semEstimator.estimate();
//
// this.params = params;
//
// log();
// }
/**
* Generates a simple exemplar of this class to test serialization.
*
* @see TetradSerializableUtils
*/
public static SemEstimatorWrapper serializableInstance() {
List<Node> variables = new LinkedList<>();
ContinuousVariable x = new ContinuousVariable("X");
variables.add(x);
DataSet dataSet = new ColtDataSet(10, variables);
for (int i = 0; i < dataSet.getNumRows(); i++) {
for (int j = 0; j < dataSet.getNumColumns(); j++) {
dataSet.setDouble(i, j, RandomUtil.getInstance().nextDouble());
}
}
Dag dag = new Dag();
dag.addNode(x);
SemPm pm = new SemPm(dag);
Parameters params1 = new Parameters();
return new SemEstimatorWrapper(dataSet, pm, params1);
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class MbFanSearchRunner method getIndependenceTest.
public IndependenceTest getIndependenceTest() {
Object dataModel = getDataModel();
if (dataModel == null) {
dataModel = getSourceGraph();
}
Parameters params = getParams();
IndTestType testType = (IndTestType) params.get("indTestType", IndTestType.FISHER_Z);
return new IndTestChooser().getTest(dataModel, params, testType);
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class LingamStructureRunner method execute.
// ============================PUBLIC METHODS==========================//
/**
* Executes the algorithm, producing (at least) a result workbench. Must be
* implemented in the extending class.
*/
public void execute() {
DataModel source = getDataModel();
if (!(source instanceof DataSet)) {
throw new IllegalArgumentException("Expecting a rectangular data set.");
}
DataSet data = (DataSet) source;
if (!data.isContinuous()) {
throw new IllegalArgumentException("Expecting a continuous data set.");
}
// Lingam_old lingam = new Lingam_old();
// lingam.setAlternativePenalty(getParameters().getAlternativePenalty());
// lingam.setPruningDone(true);
// lingam.setAlternativePenalty(getParameters().getAlternativePenalty());
// GraphWithParameters result = lingam.lingam(data);
// Graph graph = result.getGraph();
Lingam lingam = new Lingam();
Parameters params = getParams();
Graph graph = lingam.search(data);
setResultGraph(graph);
if (getSourceGraph() != null) {
GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
} else {
GraphUtils.circleLayout(graph, 200, 200, 150);
}
}
use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.
the class PcStableMaxLocalRunner method execute.
// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
IndependenceTest independenceTest = getIndependenceTest();
Parameters testParams = getParams();
PcStableMaxLocal search = new PcStableMaxLocal(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 CeFanSearchRunner method getIndependenceTest.
public IndependenceTest getIndependenceTest() {
Object dataModel = getDataModel();
if (dataModel == null) {
dataModel = getSourceGraph();
}
Parameters params = getParams();
IndTestType testType = (IndTestType) params.get("indTestType", IndTestType.FISHER_Z);
return new IndTestChooser().getTest(dataModel, params, testType);
}
Aggregations