use of edu.cmu.tetrad.search.TestType in project tetrad by cmu-phil.
the class Fofc method search.
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
ICovarianceMatrix cov = DataUtils.getCovMatrix(dataSet);
double alpha = parameters.getDouble("alpha");
boolean wishart = parameters.getBoolean("useWishart", true);
TestType testType;
if (wishart) {
testType = TestType.TETRAD_WISHART;
} else {
testType = TestType.TETRAD_DELTA;
}
boolean gap = parameters.getBoolean("useGap", true);
FindOneFactorClusters.Algorithm algorithm;
if (gap) {
algorithm = FindOneFactorClusters.Algorithm.GAP;
} else {
algorithm = FindOneFactorClusters.Algorithm.SAG;
}
edu.cmu.tetrad.search.FindOneFactorClusters search = new edu.cmu.tetrad.search.FindOneFactorClusters(cov, testType, algorithm, alpha);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
Fofc algorithm = new Fofc();
// algorithm.setKnowledge(knowledge);
// if (initialGraph != null) {
// algorithm.setInitialGraph(initialGraph);
// }
DataSet data = (DataSet) dataSet;
GeneralBootstrapTest search = new GeneralBootstrapTest(data, algorithm, parameters.getInt("bootstrapSampleSize"));
search.setKnowledge(knowledge);
BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
switch(parameters.getInt("bootstrapEnsemble", 1)) {
case 0:
edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
break;
case 1:
edgeEnsemble = BootstrapEdgeEnsemble.Highest;
break;
case 2:
edgeEnsemble = BootstrapEdgeEnsemble.Majority;
}
search.setEdgeEnsemble(edgeEnsemble);
search.setParameters(parameters);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
}
}
Aggregations