use of edu.cmu.tetrad.algcomparison.simulation.Simulations in project tetrad by cmu-phil.
the class TestCopy method main.
/**
* An example script to simulate data and run a comparison analysis on it.
*
* @author jdramsey
*/
public static void main(String... args) {
Parameters parameters = new Parameters();
parameters.set("numRuns", 10);
parameters.set("numMeasures", 100);
parameters.set("avgDegree", 2, 4, 6);
parameters.set("sampleSize", 200);
parameters.set("alpha", 1e-4, 1e-3, 1e-2);
parameters.set("penaltyDiscount", 1);
Statistics statistics = new Statistics();
statistics.add(new ParameterColumn("sampleSize"));
statistics.add(new ParameterColumn("avgDegree"));
statistics.add(new ParameterColumn("alpha"));
statistics.add(new AdjacencyPrecision());
statistics.add(new AdjacencyRecall());
statistics.add(new ArrowheadPrecision());
statistics.add(new ArrowheadRecall());
statistics.add(new MathewsCorrAdj());
statistics.add(new MathewsCorrArrow());
statistics.add(new F1Adj());
statistics.add(new F1Arrow());
statistics.add(new SHD());
statistics.add(new ElapsedTime());
statistics.setWeight("AP", 1.0);
statistics.setWeight("AHP", 1.0);
Algorithms algorithms = new Algorithms();
algorithms.add(new Pc(new FisherZ()));
algorithms.add(new PcStableMax(new FisherZ(), false));
Simulations simulations = new Simulations();
simulations.add(new SemSimulation(new RandomForward()));
Comparison comparison = new Comparison();
comparison.setShowAlgorithmIndices(true);
comparison.setShowSimulationIndices(true);
comparison.setSortByUtility(true);
comparison.setShowUtilities(true);
comparison.setParallelized(true);
comparison.compareFromSimulations("comparison", simulations, algorithms, statistics, parameters);
}
use of edu.cmu.tetrad.algcomparison.simulation.Simulations in project tetrad by cmu-phil.
the class TimeoutComparisonTest method testTimeoutComparison.
/**
* Test of setComparisonGraph method, of class TimeoutComparison.
*
* @throws IOException
*/
@Ignore
@Test
public void testTimeoutComparison() throws IOException {
Parameters parameters = getParameters();
Statistics statistics = getStatistics();
Algorithms algorithms = getAlgorithms();
Simulations simulations = getSimulations();
String resultsPath = tmpDir.newFolder("comparison").toString();
TimeoutComparison comparisonEngine = getTetradComparisonEngine();
comparisonEngine.compareFromSimulations(resultsPath, simulations, algorithms, statistics, parameters, 60, TimeUnit.SECONDS);
System.out.println("================================================================================");
System.out.println("Output File:");
System.out.println("================================================================================");
Path outputFile = Paths.get(resultsPath, "Comparison.txt");
if (Files.exists(outputFile)) {
try (Stream<String> stream = Files.lines(outputFile)) {
stream.forEach(out::println);
}
}
System.out.println("================================================================================");
}
Aggregations