Search in sources :

Example 1 with BuildPureClusters

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

the class Bpc 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;
        }
        TestType purifyType = TestType.TETRAD_BASED;
        BuildPureClusters bpc = new BuildPureClusters(cov, alpha, testType, purifyType);
        bpc.setVerbose(parameters.getBoolean("verbose"));
        return bpc.search();
    } else {
        Bpc algorithm = new Bpc();
        // 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();
    }
}
Also used : GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) TestType(edu.cmu.tetrad.search.TestType) BuildPureClusters(edu.cmu.tetrad.search.BuildPureClusters)

Aggregations

BuildPureClusters (edu.cmu.tetrad.search.BuildPureClusters)1 TestType (edu.cmu.tetrad.search.TestType)1 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)1 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)1