Search in sources :

Example 56 with GeneralBootstrapTest

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

the class FgesConcatenated 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);
        Graph initial = null;
        if (initialGraph != null) {
            initial = initialGraph.search(dataSet, parameters);
        }
        edu.cmu.tetrad.search.Fges search = new edu.cmu.tetrad.search.Fges(score.getScore(dataSet, parameters));
        search.setFaithfulnessAssumed(parameters.getBoolean("faithfulnessAssumed"));
        search.setKnowledge(knowledge);
        search.setVerbose(parameters.getBoolean("verbose"));
        search.setMaxDegree(parameters.getInt("maxDegree"));
        Object obj = parameters.get("printStedu.cmream");
        if (obj instanceof PrintStream) {
            search.setOut((PrintStream) obj);
        }
        if (initial != null) {
            search.setInitialGraph(initial);
        }
        return search.search();
    } else {
        FgesConcatenated fgesConcatenated = new FgesConcatenated(score, initialGraph);
        fgesConcatenated.setCompareToTrue(compareToTrue);
        // fgesConcatenated.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataModels) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, fgesConcatenated, 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) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) ArrayList(java.util.ArrayList) EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) Graph(edu.cmu.tetrad.graph.Graph)

Example 57 with GeneralBootstrapTest

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

the class ImagesCcd method search.

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

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

the class ImagesCcd 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);
        }
        SemBicScoreImages score = new SemBicScoreImages(dataModels);
        score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
        IndependenceTest test = new IndTestScore(score);
        edu.cmu.tetrad.search.CcdMax search = new edu.cmu.tetrad.search.CcdMax(test);
        search.setCollapseTiers(parameters.getBoolean("collapseTiers"));
        search.setOrientConcurrentFeedbackLoops(parameters.getBoolean("orientVisibleFeedbackLoops"));
        search.setDoColliderOrientations(parameters.getBoolean("doColliderOrientation"));
        search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
        search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
        search.setDepth(parameters.getInt("depth"));
        search.setApplyOrientAwayFromCollider(parameters.getBoolean("applyR1"));
        search.setUseOrientTowardDConnections(parameters.getBoolean("orientTowardDConnections"));
        search.setKnowledge(knowledge);
        search.setDepth(parameters.getInt("depth"));
        return search.search();
    } else {
        ImagesCcd imagesCcd = new ImagesCcd();
        // imagesCcd.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataModels) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, imagesCcd, 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) edu.cmu.tetrad.search(edu.cmu.tetrad.search)

Example 59 with GeneralBootstrapTest

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

the class ImagesSemBic method search.

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

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

the class Fofc 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;
        }
        boolean gap = parameters.getBoolean("useGap", true);
        FindOneFactorClusters.Algorithm algorithm;
        if (gap) {
            algorithm = FindOneFactorClusters.Algorithm.GAP;
        } else {
            algorithm = FindOneFactorClusters.Algorithm.SAG;
        }
        edu.cmu.tetrad.search.FindOneFactorClusters search = new edu.cmu.tetrad.search.FindOneFactorClusters(cov, testType, algorithm, alpha);
        search.setVerbose(parameters.getBoolean("verbose"));
        return search.search();
    } else {
        Fofc algorithm = new Fofc();
        // 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) FindOneFactorClusters(edu.cmu.tetrad.search.FindOneFactorClusters) FindOneFactorClusters(edu.cmu.tetrad.search.FindOneFactorClusters)

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