Search in sources :

Example 46 with Parameters

use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.

the class TestSemIm method test8.

@Test
public void test8() {
    Node x1 = new GraphNode("X1");
    Node x2 = new GraphNode("X2");
    Node x3 = new GraphNode("X3");
    Node x4 = new GraphNode("X4");
    Graph g = new SemGraph();
    g.addNode(x1);
    g.addNode(x2);
    g.addNode(x3);
    g.addNode(x4);
    g.addDirectedEdge(x1, x4);
    g.addDirectedEdge(x2, x4);
    g.addDirectedEdge(x3, x4);
    g.addBidirectedEdge(x1, x2);
    SemPm semPm = new SemPm(g);
    Parameters params = new Parameters();
    SemIm semIm = new SemIm(semPm, params);
    SemIm modified = modifySemImStandardizedInterventionOnTargetParents(semIm, x4);
    modified.simulateData(1000, false);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) Test(org.junit.Test)

Example 47 with Parameters

use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.

the class TestSimulatedFmr3 method TestCycles_Data_fMRI_FASK.

public void TestCycles_Data_fMRI_FASK() {
    Parameters parameters = new Parameters();
    parameters.set("penaltyDiscount", 4);
    parameters.set("depth", -1);
    parameters.set("twoCycleAlpha", .001);
    parameters.set("thresholdForReversing", 1);
    parameters.set("numRuns", 60);
    // parameters.set("randomSelectionSize", 10);
    // parameters.set("penaltyDiscount", 6);
    // parameters.set("depth", -1);
    // parameters.set("twoCycleAlpha", 1e-15);
    // 
    // parameters.set("numRuns", 10);
    // For automatically generated concatenations if you're doing them.
    // parameters.set("randomSelectionSize", 5);
    parameters.set("Structure", "Placeholder");
    Statistics statistics = new Statistics();
    statistics.add(new ParameterColumn("Structure"));
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    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("AP", 1.0);
    statistics.setWeight("AR", 1.0);
    statistics.setWeight("AHP", 1.0);
    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/Cycles_Data_fMRI_Training/";
    String dir = "/Users/user/Downloads/CyclesTestingData/";
    String subdir = "data_fslfilter_concat";
    // 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 Fask());
    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.compareFromSimulations("comparison", 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)

Example 48 with Parameters

use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.

the class TestSimulatedFmr3 method TestMadelynDAta.

public void TestMadelynDAta() {
    Parameters parameters = new Parameters();
    parameters.set("penaltyDiscount", 10);
    parameters.set("depth", -1);
    parameters.set("twoCycleAlpha", 1e-12);
    parameters.set("thresholdForReversing", 1);
    parameters.set("numRuns", 10);
    parameters.set("randomSelectionSize", 10);
    // parameters.set("penaltyDiscount", 6);
    // parameters.set("depth", -1);
    // parameters.set("twoCycleAlpha", 1e-15);
    // 
    // parameters.set("numRuns", 10);
    // For automatically generated concatenations if you're doing them.
    // parameters.set("randomSelectionSize", 5);
    parameters.set("Structure", "Placeholder");
    Statistics statistics = new Statistics();
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    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("AP", 1.0);
    statistics.setWeight("AR", 1.0);
    statistics.setWeight("AHP", 1.0);
    statistics.setWeight("AHR", 1.0);
    statistics.setWeight("2CP", 1.0);
    statistics.setWeight("2CR", 1.0);
    statistics.setWeight("2CFP", 1.0);
    String dir = "/Users/user/Downloads/SimulatedData_2/";
    String[] dirs = new String[] { "AllNegative", "AllPositive", "TwoCycleNegative", "XYNegative", "XYPositive", "XZNegative", "XZPositive", "YZNegative", "YZPositive" };
    String[] suffixes = new String[] { "allneg", "allpos", "twocycleneg", "XYneg", "XYpos", "XZneg", "XZpos", "YZneg", "YZpos" };
    for (int i = 0; i < dirs.length; i++) {
        System.out.println("Directory " + dirs[i]);
        Simulations simulations = new Simulations();
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 1));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 2));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 3));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 4));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 5));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 6));
        simulations.add(new LoadMadelynData(dir + dirs[i], suffixes[i], 7));
        Algorithms algorithms = new Algorithms();
        algorithms.add(new FaskConcatenated());
        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.setComparisonGraph(Comparison.ComparisonGraph.true_DAG);
        comparison.compareFromSimulations("comparison_" + dirs[i], 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)

Example 49 with Parameters

use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.

the class TestGenerateMixedData method test1.

public void test1() {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 100);
    parameters.set("numMeasures", 100);
    parameters.set("avgDegree", 4);
    parameters.set("sampleSize", 5000);
    parameters.set("maxDegree", 8);
    parameters.set("minCategories", 2);
    parameters.set("maxCategories", 5);
    parameters.set("percentDiscrete", 50);
    parameters.set("intervalBetweenRecordings", 20);
    parameters.set("varLow", 1.);
    parameters.set("varHigh", 3.);
    parameters.set("coefLow", .1);
    parameters.set("coefHigh", 1.5);
    parameters.set("coefSymmetric", true);
    parameters.set("meanLow", -1);
    parameters.set("meanHigh", 1);
    final LeeHastieSimulation simulation = new LeeHastieSimulation(new RandomForward());
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.setShowSimulationIndices(false);
    comparison.setSortByUtility(false);
    comparison.setShowUtilities(false);
    comparison.setParallelized(false);
    comparison.setSaveGraphs(true);
    comparison.setTabDelimitedTables(true);
    comparison.saveToFiles("mixed.lee.hastie.avg.degree.4", simulation, parameters);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) LeeHastieSimulation(edu.cmu.tetrad.algcomparison.simulation.LeeHastieSimulation) Comparison(edu.cmu.tetrad.algcomparison.Comparison) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 50 with Parameters

use of edu.cmu.tetrad.util.Parameters in project tetrad by cmu-phil.

the class TestKunMeasurementError method TestCycles_Data_fMRI_FASK.

public void TestCycles_Data_fMRI_FASK() {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 20);
    parameters.set("penaltyDiscount", 1);
    parameters.set("depth", -1);
    parameters.set("determinismThreshold", .1);
    parameters.set("verbose", true);
    parameters.set("symmetricFirstStep", false);
    parameters.set("faithfulnessAssumed", false);
    parameters.set("maxDegree", 100);
    Statistics statistics = new Statistics();
    // statistics.add(new ParameterColumn("determinismThreshold"));
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    statistics.add(new ArrowheadPrecision());
    statistics.add(new ArrowheadRecall());
    Simulations simulations = new Simulations();
    // String dir = "/Users/user/Downloads/Simul1_T500";
    String dir = "/Users/user/Downloads/Simul1_T2000";
    // String dir = "/Users/user/Downloads/Simul2_T500";
    // String dir = "/Users/user/Downloads/Simul2_T2000";
    simulations.add(new LoadContinuousDataAndSingleGraphKun(dir, "Cov_X"));
    simulations.add(new LoadContinuousDataAndSingleGraphKun(dir, "Cov_tilde"));
    simulations.add(new LoadContinuousDataAndSingleGraphKun(dir, "Cov_tilde_hat"));
    // 
    Algorithms algorithms = new Algorithms();
    IndependenceWrapper test = new SemBicTest();
    ScoreWrapper score = new SemBicScore();
    algorithms.add(new Pc(test));
    algorithms.add(new Fges(score));
    algorithms.add(new Pcd());
    algorithms.add(new FgesD());
    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.compareFromSimulations("comparison", simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) SemBicTest(edu.cmu.tetrad.algcomparison.independence.SemBicTest) Parameters(edu.cmu.tetrad.util.Parameters) ScoreWrapper(edu.cmu.tetrad.algcomparison.score.ScoreWrapper) Fges(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges) Pcd(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Pcd) IndependenceWrapper(edu.cmu.tetrad.algcomparison.independence.IndependenceWrapper) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) Pc(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Pc) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore) FgesD(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.FgesD)

Aggregations

Parameters (edu.cmu.tetrad.util.Parameters)134 Comparison (edu.cmu.tetrad.algcomparison.Comparison)30 Graph (edu.cmu.tetrad.graph.Graph)26 Algorithms (edu.cmu.tetrad.algcomparison.algorithm.Algorithms)25 DataSet (edu.cmu.tetrad.data.DataSet)22 Knowledge2 (edu.cmu.tetrad.data.Knowledge2)20 IKnowledge (edu.cmu.tetrad.data.IKnowledge)18 Simulations (edu.cmu.tetrad.algcomparison.simulation.Simulations)17 RandomForward (edu.cmu.tetrad.algcomparison.graph.RandomForward)14 ArrayList (java.util.ArrayList)14 SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)13 Test (org.junit.Test)13 Node (edu.cmu.tetrad.graph.Node)11 ActionEvent (java.awt.event.ActionEvent)10 ActionListener (java.awt.event.ActionListener)10 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)8 Fges (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges)8 DataModel (edu.cmu.tetrad.data.DataModel)8 TitledBorder (javax.swing.border.TitledBorder)8 FisherZ (edu.cmu.tetrad.algcomparison.independence.FisherZ)7