use of edu.cmu.tetrad.search.FasLofs in project tetrad by cmu-phil.
the class FasLofsConcatenated method search.
@Override
public Graph search(List<DataModel> dataModels, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
List<DataSet> dataSets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
dataSets.add((DataSet) dataModel);
}
DataSet dataSet = DataUtils.concatenate(dataSets);
edu.cmu.tetrad.search.FasLofs search = new FasLofs(dataSet, rule);
search.setDepth(parameters.getInt("depth"));
search.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
search.setKnowledge(knowledge);
return getGraph(search);
} else {
FasLofsConcatenated algorithm = new FasLofsConcatenated(rule);
// algorithm.setKnowledge(knowledge);
List<DataSet> datasets = new ArrayList<>();
for (DataModel dataModel : dataModels) {
datasets.add((DataSet) dataModel);
}
GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, 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