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);
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations