Search in sources :

Example 16 with SemBicScore

use of edu.cmu.tetrad.algcomparison.score.SemBicScore in project tetrad by cmu-phil.

the class TestSimulatedFmri2 method TestCycles_Data_fMRI_FASK.

public void TestCycles_Data_fMRI_FASK() {
    Parameters parameters = new Parameters();
    parameters.set("penaltyDiscount", 8);
    parameters.set("depth", -1);
    parameters.set("faskDelta", -0.2);
    parameters.set("twoCycleAlpha", 1e-15);
    parameters.set("numRuns", 60);
    // parameters.set("randomSelectionSize", 1);
    parameters.set("Structure", "Placeholder");
    Statistics statistics = new Statistics();
    statistics.add(new ParameterColumn("Structure"));
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    // statistics.add(new MathewsCorrAdj());
    statistics.add(new ArrowheadPrecision());
    statistics.add(new ArrowheadRecall());
    statistics.add(new TwoCyclePrecision());
    statistics.add(new TwoCycleRecall());
    statistics.add(new TwoCycleFalsePositive());
    statistics.add(new TwoCycleFalseNegative());
    statistics.add(new TwoCycleTruePositive());
    statistics.add(new ElapsedTime());
    statistics.setWeight("AHR", 1.0);
    statistics.setWeight("2CP", 1.0);
    statistics.setWeight("2CR", 1.0);
    statistics.setWeight("2CFP", 1.0);
    Simulations simulations = new Simulations();
    String dir = "/Users/user/Downloads/CyclesTestingData/";
    String subdir = "data_fslfilter_concat";
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network1_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network2_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network3_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network4_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont_p3n7", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont_p7n3", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_cont", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_cont", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_cont", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_cont_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_cont", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_cont_amp", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Diamond", subdir));
    simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Markov_Complex_1", subdir));
    Algorithms algorithms = new Algorithms();
    algorithms.add(new edu.cmu.tetrad.algcomparison.algorithm.multi.Fask(new SemBicScore()));
    // 
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.setShowSimulationIndices(true);
    comparison.setSortByUtility(false);
    comparison.setShowUtilities(false);
    comparison.setParallelized(false);
    comparison.setSaveGraphs(false);
    comparison.setTabDelimitedTables(false);
    comparison.setSaveGraphs(true);
    String directory = "comparison_testing_nonconcat";
    comparison.compareFromSimulations(directory, simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Parameters(edu.cmu.tetrad.util.Parameters) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore)

Example 17 with SemBicScore

use of edu.cmu.tetrad.algcomparison.score.SemBicScore in project tetrad by cmu-phil.

the class TestSimulatedFmri method task.

private void task(boolean testing) {
    Parameters parameters = new Parameters();
    parameters.set("penaltyDiscount", 4);
    parameters.set("depth", -1);
    parameters.set("twoCycleAlpha", 1e-10);
    parameters.set("faskDelta", -.2);
    parameters.set("reverseOrientationsBySignOfCorrelation", false);
    parameters.set("reverseOrientationsBySkewnessOfVariables", false);
    parameters.set("numRuns", 10);
    parameters.set("randomSelectionSize", 10);
    parameters.set("Structure", "Placeholder");
    Statistics statistics = new Statistics();
    statistics.add(new ParameterColumn("Structure"));
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    // statistics.add(new MathewsCorrAdj());
    statistics.add(new ArrowheadPrecision());
    statistics.add(new ArrowheadRecall());
    statistics.add(new TwoCyclePrecision());
    statistics.add(new TwoCycleRecall());
    statistics.add(new TwoCycleFalsePositive());
    statistics.add(new TwoCycleFalseNegative());
    statistics.add(new TwoCycleTruePositive());
    statistics.add(new ElapsedTime());
    statistics.setWeight("AHR", 1.0);
    statistics.setWeight("2CP", 1.0);
    statistics.setWeight("2CR", 1.0);
    statistics.setWeight("2CFP", 1.0);
    Simulations simulations = new Simulations();
    if (!testing) {
        String dir = "/Users/user/Downloads/Cycles_Data_fMRI/";
        String subdir = "data_fslfilter";
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network1_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network2_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network3_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network4_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_contr", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_contr_p2n6", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_contr_p6n2", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_contr", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_contr", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_contr", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_contr_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_contr", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_contr_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Diamond", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Markov_Complex_1", subdir));
    } else {
        String dir = "/Users/user/Downloads/CyclesTestingData/";
        String subdir = "data_fslfilter";
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network1_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network2_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network3_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network4_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont_p3n7", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network5_cont_p7n3", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network6_cont", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network7_cont", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_amp_cont", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network8_cont_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_amp_cont", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Network9_cont_amp", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Diamond", subdir));
        simulations.add(new LoadContinuousDataAndSingleGraph(dir + "Markov_Complex_1", subdir));
    }
    Algorithms algorithms = new Algorithms();
    algorithms.add(new FaskConcatenated(new SemBicScore()));
    // algorithms.add(new FaskGfciConcatenated(new SemBicTest()));
    // algorithms.add(new FasLofsConcatenated(Lofs2.Rule.RSkew));
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.setShowSimulationIndices(true);
    comparison.setSortByUtility(false);
    comparison.setShowUtilities(false);
    comparison.setParallelized(false);
    comparison.setSaveGraphs(false);
    comparison.setTabDelimitedTables(false);
    comparison.setSaveGraphs(true);
    String directory;
    if (!testing) {
        directory = "comparison_training";
    } else {
        directory = "comparison_testing";
    }
    comparison.compareFromSimulations(directory, simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Parameters(edu.cmu.tetrad.util.Parameters) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore)

Aggregations

SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)17 Parameters (edu.cmu.tetrad.util.Parameters)13 Algorithms (edu.cmu.tetrad.algcomparison.algorithm.Algorithms)12 Comparison (edu.cmu.tetrad.algcomparison.Comparison)11 Simulations (edu.cmu.tetrad.algcomparison.simulation.Simulations)9 Fges (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges)7 FisherZ (edu.cmu.tetrad.algcomparison.independence.FisherZ)5 RandomForward (edu.cmu.tetrad.algcomparison.graph.RandomForward)4 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)3 Gfci (edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.Gfci)3 ScoreWrapper (edu.cmu.tetrad.algcomparison.score.ScoreWrapper)3 FirstInflection (edu.cmu.tetrad.algcomparison.algorithm.FirstInflection)2 IndependenceWrapper (edu.cmu.tetrad.algcomparison.independence.IndependenceWrapper)2 LinearFisherModel (edu.cmu.tetrad.algcomparison.simulation.LinearFisherModel)2 DataSet (edu.cmu.tetrad.data.DataSet)2 Graph (edu.cmu.tetrad.graph.Graph)2 LargeScaleSimulation (edu.cmu.tetrad.sem.LargeScaleSimulation)2 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)2 Test (org.junit.Test)2 StARS (edu.cmu.tetrad.algcomparison.algorithm.StARS)1