Search in sources :

Example 1 with FasLofs

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();
    }
}
Also used : edu.cmu.tetrad.search(edu.cmu.tetrad.search) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) ArrayList(java.util.ArrayList) FasLofs(edu.cmu.tetrad.search.FasLofs) FasLofs(edu.cmu.tetrad.search.FasLofs)

Aggregations

edu.cmu.tetrad.search (edu.cmu.tetrad.search)1 FasLofs (edu.cmu.tetrad.search.FasLofs)1 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)1 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)1 ArrayList (java.util.ArrayList)1