Search in sources :

Example 6 with IndTestScore

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

the class TsImages method search.

@Override
public Graph search(DataModel dataModel, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        DataSet dataSet = (DataSet) dataModel;
        TsGFci search;
        Score score1 = score.getScore(dataSet, parameters);
        IndependenceTest test = new IndTestScore(score1);
        search = new TsGFci(test, score1);
        search.setKnowledge(dataSet.getKnowledge());
        return search.search();
    } else {
        TsImages algorithm = new TsImages(score);
        DataSet data = (DataSet) dataModel;
        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 : IndTestScore(edu.cmu.tetrad.search.IndTestScore) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore) BdeuScore(edu.cmu.tetrad.algcomparison.score.BdeuScore) Score(edu.cmu.tetrad.search.Score) IndependenceTest(edu.cmu.tetrad.search.IndependenceTest) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) DataSet(edu.cmu.tetrad.data.DataSet) IndTestScore(edu.cmu.tetrad.search.IndTestScore) TsGFci(edu.cmu.tetrad.search.TsGFci)

Example 7 with IndTestScore

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

the class TsImagesSemBic 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);
        }
        edu.cmu.tetrad.search.TsGFci search = new edu.cmu.tetrad.search.TsGFci(new IndTestScore(new SemBicScoreImages(dataModels)), new SemBicScoreImages(dataModels));
        search.setFaithfulnessAssumed(true);
        search.setKnowledge(knowledge);
        return search.search();
    } else {
        TsImagesSemBic tsImagesSemBic = new TsImagesSemBic();
        // tsImagesSemBic.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataModels) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, tsImagesSemBic, 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) IndTestScore(edu.cmu.tetrad.search.IndTestScore) ArrayList(java.util.ArrayList) SemBicScoreImages(edu.cmu.tetrad.search.SemBicScoreImages)

Aggregations

IndTestScore (edu.cmu.tetrad.search.IndTestScore)7 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)4 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)4 IndependenceTest (edu.cmu.tetrad.search.IndependenceTest)3 ArrayList (java.util.ArrayList)3 BdeuScore (edu.cmu.tetrad.algcomparison.score.BdeuScore)2 SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)2 DataSet (edu.cmu.tetrad.data.DataSet)2 SemBicScoreDeterministic (edu.cmu.tetrad.search.SemBicScoreDeterministic)2 SemBicScoreImages (edu.cmu.tetrad.search.SemBicScoreImages)2 TsGFci (edu.cmu.tetrad.search.TsGFci)2 CovarianceMatrixOnTheFly (edu.cmu.tetrad.data.CovarianceMatrixOnTheFly)1 DataModel (edu.cmu.tetrad.data.DataModel)1 IKnowledge (edu.cmu.tetrad.data.IKnowledge)1 Graph (edu.cmu.tetrad.graph.Graph)1 Node (edu.cmu.tetrad.graph.Node)1 BdeuScoreImages (edu.cmu.tetrad.search.BdeuScoreImages)1 Fas (edu.cmu.tetrad.search.Fas)1 PcStableMax (edu.cmu.tetrad.search.PcStableMax)1 Score (edu.cmu.tetrad.search.Score)1