Search in sources :

Example 46 with GeneralBootstrapTest

use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest 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)

Example 47 with GeneralBootstrapTest

use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.

the class PcStableMaxConcatenated method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (!parameters.getBoolean("bootstrapping")) {
        return search(Collections.singletonList((DataModel) DataUtils.getContinuousDataSet(dataSet)), parameters);
    } else {
        PcStableMaxConcatenated pcStableMaxConcatenated = new PcStableMaxConcatenated(test, compareToTrue);
        pcStableMaxConcatenated.setKnowledge(knowledge);
        List<DataSet> dataSets = Collections.singletonList(DataUtils.getContinuousDataSet(dataSet));
        GeneralBootstrapTest search = new GeneralBootstrapTest(dataSets, pcStableMaxConcatenated, parameters.getInt("bootstrapSampleSize"));
        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)

Example 48 with GeneralBootstrapTest

use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.

the class PcStableMaxConcatenated 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);
        PcStableMax search = new PcStableMax(test.getTest(dataSet, parameters));
        search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
        search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
        search.setKnowledge(knowledge);
        search.setDepth(parameters.getInt("depth"));
        return search.search();
    } else {
        PcStableMaxConcatenated pcStableMaxConcatenated = new PcStableMaxConcatenated(test, compareToTrue);
        // pcStableMaxConcatenated.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataModels) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, pcStableMaxConcatenated, 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) ArrayList(java.util.ArrayList) PcStableMax(edu.cmu.tetrad.search.PcStableMax)

Example 49 with GeneralBootstrapTest

use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.

the class PcFges method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        DataSet _dataSet = (DataSet) dataSet;
        ICovarianceMatrix cov = new CovarianceMatrix(_dataSet);
        // parameters.getDouble("alpha")));
        edu.cmu.tetrad.search.FasStable fas = new edu.cmu.tetrad.search.FasStable(new IndTestFisherZ(cov, 0.001));
        Graph bound = fas.search();
        edu.cmu.tetrad.search.Fges search = new edu.cmu.tetrad.search.Fges(score.getScore(cov, parameters));
        search.setVerbose(parameters.getBoolean("verbose"));
        search.setFaithfulnessAssumed(parameters.getBoolean("faithfulnessAssumed"));
        search.setKnowledge(knowledge);
        search.setMaxDegree(parameters.getInt("maxDegree"));
        search.setSymmetricFirstStep(parameters.getBoolean("symmetricFirstStep"));
        System.out.println("Bound graph done");
        Object obj = parameters.get("printStream");
        if (obj instanceof PrintStream) {
            search.setOut((PrintStream) obj);
        }
        search.setBoundGraph(bound);
        return search.search();
    } else {
        PcFges algorithm = new PcFges(score, compareToTrue);
        // 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 : PrintStream(java.io.PrintStream) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) IndTestFisherZ(edu.cmu.tetrad.search.IndTestFisherZ) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) TakesInitialGraph(edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph) Graph(edu.cmu.tetrad.graph.Graph)

Example 50 with GeneralBootstrapTest

use of edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest in project tetrad by cmu-phil.

the class PcStableMax method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        if (algorithm != null) {
        // initialGraph = algorithm.search(dataSet, parameters);
        }
        edu.cmu.tetrad.search.PcAll search = new edu.cmu.tetrad.search.PcAll(test.getTest(dataSet, parameters), initialGraph);
        search.setDepth(parameters.getInt("depth"));
        search.setKnowledge(knowledge);
        search.setFasRule(edu.cmu.tetrad.search.PcAll.FasRule.FAS_STABLE);
        search.setColliderDiscovery(PcAll.ColliderDiscovery.MAX_P);
        search.setConflictRule(edu.cmu.tetrad.search.PcAll.ConflictRule.PRIORITY);
        search.setVerbose(parameters.getBoolean("verbose"));
        search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
        search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
        return search.search();
    } else {
        PcStableMax pcStableMax = new PcStableMax(test, compareToTrue);
        // pcStableMax.setKnowledge(knowledge);
        if (initialGraph != null) {
            pcStableMax.setInitialGraph(initialGraph);
        }
        DataSet data = (DataSet) dataSet;
        GeneralBootstrapTest search = new GeneralBootstrapTest(data, pcStableMax, 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) PcAll(edu.cmu.tetrad.search.PcAll) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) DataSet(edu.cmu.tetrad.data.DataSet) PcAll(edu.cmu.tetrad.search.PcAll)

Aggregations

GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)72 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)66 DataSet (edu.cmu.tetrad.data.DataSet)32 Graph (edu.cmu.tetrad.graph.Graph)21 ArrayList (java.util.ArrayList)21 EdgeListGraph (edu.cmu.tetrad.graph.EdgeListGraph)15 TakesInitialGraph (edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph)10 Lofs2 (edu.cmu.tetrad.search.Lofs2)10 Node (edu.cmu.tetrad.graph.Node)6 Parameters (edu.cmu.tetrad.util.Parameters)6 PrintStream (java.io.PrintStream)6 Test (org.junit.Test)6 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)5 PcAll (edu.cmu.tetrad.search.PcAll)5 Fges (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges)4 IndependenceWrapper (edu.cmu.tetrad.algcomparison.independence.IndependenceWrapper)4 ScoreWrapper (edu.cmu.tetrad.algcomparison.score.ScoreWrapper)4 edu.cmu.tetrad.search (edu.cmu.tetrad.search)4 DagToPag (edu.cmu.tetrad.search.DagToPag)4 IndTestScore (edu.cmu.tetrad.search.IndTestScore)4