Search in sources :

Example 1 with SemBicScoreImages3

use of edu.cmu.tetrad.search.SemBicScoreImages3 in project tetrad by cmu-phil.

the class ImagesPcStableMax 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);
        }
        SemBicScoreImages3 score = new SemBicScoreImages3(dataSets);
        score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
        IndependenceTest test = new IndTestScore(score);
        PcStableMax search = new PcStableMax(test);
        search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
        search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
        search.setKnowledge(knowledge);
        search.setDepth(parameters.getInt("depth"));
        return search.search();
    } else {
        ImagesPcStableMax imagesPcStableMax = new ImagesPcStableMax();
        // imagesPcStableMax.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataModels) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, imagesPcStableMax, 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 : IndependenceTest(edu.cmu.tetrad.search.IndependenceTest) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) IndTestScore(edu.cmu.tetrad.search.IndTestScore) ArrayList(java.util.ArrayList) PcStableMax(edu.cmu.tetrad.search.PcStableMax) SemBicScoreImages3(edu.cmu.tetrad.search.SemBicScoreImages3)

Aggregations

IndTestScore (edu.cmu.tetrad.search.IndTestScore)1 IndependenceTest (edu.cmu.tetrad.search.IndependenceTest)1 PcStableMax (edu.cmu.tetrad.search.PcStableMax)1 SemBicScoreImages3 (edu.cmu.tetrad.search.SemBicScoreImages3)1 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)1 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)1 ArrayList (java.util.ArrayList)1