Search in sources :

Example 26 with BootstrapEdgeEnsemble

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

the class Fask method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        edu.cmu.tetrad.search.Fask search = new edu.cmu.tetrad.search.Fask((DataSet) dataSet, score.getScore(dataSet, parameters));
        search.setDepth(parameters.getInt("depth"));
        search.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
        search.setExtraEdgeThreshold(parameters.getDouble("extraEdgeThreshold"));
        search.setUseFasAdjacencies(parameters.getBoolean("useFasAdjacencies"));
        search.setUseSkewAdjacencies(parameters.getBoolean("useCorrDiffAdjacencies"));
        search.setAlpha(parameters.getDouble("twoCycleAlpha"));
        search.setDelta(parameters.getDouble("faskDelta"));
        // search.setPercentBootstrapForLinearityTest(parameters.getDouble("percentBootstrapForLinearityTest"));
        // search.setNumBootstrapForLinearityTest(parameters.getInt("numBootstrapForLinearityTest"));
        // search.setCutoffForLinearityTest(parameters.getDouble("cutoffForLinearityTest"));
        search.setKnowledge(knowledge);
        return getGraph(search);
    } else {
        Fask fask = new Fask(score);
        fask.setKnowledge(knowledge);
        DataSet data = (DataSet) dataSet;
        GeneralBootstrapTest search = new GeneralBootstrapTest(data, fask, 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 27 with BootstrapEdgeEnsemble

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

the class FgesConcatenated method search.

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

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

the class ImagesSemBic method search.

@Override
public Graph search(List<DataModel> dataSets, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        final SemBicScoreImages score = new SemBicScoreImages(dataSets);
        score.setPenaltyDiscount(parameters.getDouble("penaltyDiscount"));
        edu.cmu.tetrad.search.Fges search = new edu.cmu.tetrad.search.Fges(score);
        search.setKnowledge(knowledge);
        return search.search();
    } else {
        ImagesSemBic imagesSemBic = new ImagesSemBic();
        // imagesSemBic.setKnowledge(knowledge);
        List<DataSet> datasets = new ArrayList<>();
        for (DataModel dataModel : dataSets) {
            datasets.add((DataSet) dataModel);
        }
        GeneralBootstrapTest search = new GeneralBootstrapTest(datasets, imagesSemBic, 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) Fges(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges) SemBicScoreImages(edu.cmu.tetrad.search.SemBicScoreImages)

Example 29 with BootstrapEdgeEnsemble

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

the class R1 method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        Graph graph = algorithm.search(dataSet, parameters);
        if (graph != null) {
            initialGraph = graph;
        } else {
            throw new IllegalArgumentException("This R1 algorithm needs both data and a graph source as inputs; it \n" + "will orient the edges in the input graph using the data");
        }
        List<DataSet> dataSets = new ArrayList<>();
        dataSets.add(DataUtils.getContinuousDataSet(dataSet));
        Lofs2 lofs = new Lofs2(initialGraph, dataSets);
        lofs.setRule(Lofs2.Rule.R1);
        return lofs.orient();
    } else {
        R1 r1 = new R1(algorithm);
        if (initialGraph != null) {
            r1.setInitialGraph(initialGraph);
        }
        DataSet data = (DataSet) dataSet;
        GeneralBootstrapTest search = new GeneralBootstrapTest(data, r1, 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 : Lofs2(edu.cmu.tetrad.search.Lofs2) EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) TakesInitialGraph(edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph) Graph(edu.cmu.tetrad.graph.Graph) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) DataSet(edu.cmu.tetrad.data.DataSet) ArrayList(java.util.ArrayList)

Example 30 with BootstrapEdgeEnsemble

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

the class RSkew method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        Graph graph = algorithm.search(dataSet, parameters);
        if (graph != null) {
            initialGraph = graph;
        } else {
            throw new IllegalArgumentException("This RSkew algorithm needs both data and a graph source as inputs; it \n" + "will orient the edges in the input graph using the data");
        }
        List<DataSet> dataSets = new ArrayList<>();
        dataSets.add(DataUtils.getContinuousDataSet(dataSet));
        Lofs2 lofs = new Lofs2(initialGraph, dataSets);
        lofs.setRule(Lofs2.Rule.RSkew);
        return lofs.orient();
    } else {
        RSkew rSkew = new RSkew(algorithm);
        if (initialGraph != null) {
            rSkew.setInitialGraph(initialGraph);
        }
        DataSet data = (DataSet) dataSet;
        GeneralBootstrapTest search = new GeneralBootstrapTest(data, rSkew, 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 : Lofs2(edu.cmu.tetrad.search.Lofs2) EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) TakesInitialGraph(edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph) Graph(edu.cmu.tetrad.graph.Graph) GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) DataSet(edu.cmu.tetrad.data.DataSet) ArrayList(java.util.ArrayList)

Aggregations

BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)66 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)66 DataSet (edu.cmu.tetrad.data.DataSet)26 ArrayList (java.util.ArrayList)21 EdgeListGraph (edu.cmu.tetrad.graph.EdgeListGraph)15 Graph (edu.cmu.tetrad.graph.Graph)15 TakesInitialGraph (edu.cmu.tetrad.algcomparison.utils.TakesInitialGraph)10 Lofs2 (edu.cmu.tetrad.search.Lofs2)10 Node (edu.cmu.tetrad.graph.Node)6 PrintStream (java.io.PrintStream)6 PcAll (edu.cmu.tetrad.search.PcAll)5 edu.cmu.tetrad.search (edu.cmu.tetrad.search)4 IndTestScore (edu.cmu.tetrad.search.IndTestScore)4 IndependenceTest (edu.cmu.tetrad.search.IndependenceTest)4 Fges (edu.cmu.tetrad.search.Fges)3 Score (edu.cmu.tetrad.search.Score)3 Fges (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges)2 PcStableMax (edu.cmu.tetrad.search.PcStableMax)2 SemBicScoreDeterministic (edu.cmu.tetrad.search.SemBicScoreDeterministic)2 SemBicScoreImages (edu.cmu.tetrad.search.SemBicScoreImages)2