Search in sources :

Example 1 with Comparison

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

the class TestConditionalGaussianSimulation method testBryan.

public void testBryan(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numCategoriesToDiscretize", 5);
    parameters.set("numRuns", 10);
    parameters.set("numMeasures", 100);
    parameters.set("avgDegree", 2);
    parameters.set("sampleSize", 10000);
    parameters.set("minCategories", 2);
    parameters.set("maxCategories", 5);
    parameters.set("percentDiscrete", 50);
    parameters.set("differentGraphs", true);
    parameters.set("maxDegree", 5);
    parameters.set("maxIndegree", 5);
    parameters.set("maxOutdegree", 5);
    parameters.set("structurePrior", 1);
    parameters.set("fDegree", -1);
    parameters.set("discretize", true);
    // parameters.set("discretize", true, false);
    Statistics statistics = new Statistics();
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    statistics.add(new ArrowheadPrecision());
    statistics.add(new ArrowheadRecall());
    statistics.add(new ElapsedTime());
    statistics.setWeight("AHP", 1.0);
    statistics.setWeight("AHR", 1.0);
    Algorithms algorithms = new Algorithms();
    algorithms.add(new Fges(new ConditionalGaussianBicScore()));
    Simulations simulations = new Simulations();
    simulations.add(new ConditionalGaussianSimulation(new RandomForward()));
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.setShowSimulationIndices(true);
    comparison.setSortByUtility(true);
    comparison.setShowUtilities(true);
    comparison.setParallelized(false);
    comparison.compareFromSimulations("comparison", simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Parameters(edu.cmu.tetrad.util.Parameters) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward) Fges(edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) Comparison(edu.cmu.tetrad.algcomparison.Comparison) ConditionalGaussianBicScore(edu.cmu.tetrad.algcomparison.score.ConditionalGaussianBicScore) ConditionalGaussianSimulation(edu.cmu.tetrad.algcomparison.simulation.ConditionalGaussianSimulation)

Example 2 with Comparison

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

the class SpecialExampleSimulationClark method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 20);
    parameters.set("sampleSize", 1000);
    parameters.set("twoCycleAlpha", 1);
    Statistics statistics = new Statistics();
    statistics.add(new AdjacencyPrecision());
    statistics.add(new AdjacencyRecall());
    statistics.add(new ArrowheadPrecision());
    statistics.add(new ArrowheadRecall());
    // statistics.add(new TwoCycleTruePositive());
    // statistics.add(new TwoCycleFalseNegative());
    // statistics.add(new TwoCycleFalsePositive());
    // For randomm forward graph
    parameters.set("numMeasures", 10);
    parameters.set("numLatents", 0);
    parameters.set("avgDegree", 2);
    parameters.set("maxDegree", 100);
    parameters.set("maxIndegree", 100);
    parameters.set("maxOutdegree", 100);
    parameters.set("connected", false);
    // 
    // statistics.setWeight("AP", 1.0);
    // statistics.setWeight("AR", 0.5);
    Algorithms algorithms = new Algorithms();
    algorithms.add(new Fask());
    Simulations simulations = new Simulations();
    // simulations.add(new SpecialDataClark(new SpecialGraphClark()));
    simulations.add(new SpecialDataClark(new RandomForward()));
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.setShowSimulationIndices(true);
    comparison.setSortByUtility(false);
    comparison.setShowUtilities(false);
    comparison.setParallelized(true);
    comparison.setSaveGraphs(true);
    comparison.setSavePatterns(true);
    comparison.setSavePags(true);
    // comparison.saveToFiles("comparison", new SpecialDataClark(new SpecialGraphClark()), parameters);
    comparison.compareFromSimulations("comparison", simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Fask(edu.cmu.tetrad.algcomparison.algorithm.multi.Fask) Parameters(edu.cmu.tetrad.util.Parameters) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) Comparison(edu.cmu.tetrad.algcomparison.Comparison) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 3 with Comparison

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

the class ExampleCompareSimulation method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    https: parameters.set("numRuns", 10);
    parameters.set("numMeasures", 100);
    parameters.set("avgDegree", 4, 6);
    parameters.set("sampleSize", 500);
    parameters.set("alpha", 1e-4, 1e-3, 1e-2);
    Statistics statistics = new Statistics();
    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("AR", 0.5);
    Algorithms algorithms = new Algorithms();
    algorithms.add(new Pc(new FisherZ()));
    algorithms.add(new Cpc(new FisherZ(), new Fges(new SemBicScore(), false)));
    algorithms.add(new PcStable(new FisherZ()));
    algorithms.add(new CpcStable(new FisherZ()));
    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);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Parameters(edu.cmu.tetrad.util.Parameters) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) FisherZ(edu.cmu.tetrad.algcomparison.independence.FisherZ) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore)

Example 4 with Comparison

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

the class ExampleCompareFromFiles method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    // Can leave the simulation parameters out since
    // we're loading from file here.
    parameters.set("alpha", 1e-4);
    parameters.set("numRuns", 10);
    Statistics statistics = new Statistics();
    statistics.add(new ParameterColumn("avgDegree"));
    statistics.add(new ParameterColumn("sampleSize"));
    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("AR", 0.5);
    statistics.setWeight("AHP", 1.0);
    statistics.setWeight("AHR", 0.5);
    Algorithms algorithms = new Algorithms();
    algorithms.add(new Pc(new FisherZ()));
    algorithms.add(new Cpc(new FisherZ()));
    algorithms.add(new PcStable(new FisherZ()));
    algorithms.add(new CpcStable(new FisherZ()));
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(false);
    comparison.setShowSimulationIndices(false);
    comparison.setSortByUtility(true);
    comparison.setShowUtilities(true);
    comparison.setParallelized(true);
    comparison.compareFromFiles("comparison", algorithms, statistics, parameters);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) FisherZ(edu.cmu.tetrad.algcomparison.independence.FisherZ) Comparison(edu.cmu.tetrad.algcomparison.Comparison)

Example 5 with Comparison

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

the class ExampleCompareSimulationTimeSeries method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 10);
    parameters.set("numMeasures", 10);
    parameters.set("avgDegree", 4);
    parameters.set("sampleSize", 500);
    parameters.set("alpha", 1e-4, 1e-3, 1e-2);
    Statistics statistics = new Statistics();
    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("AR", 0.5);
    Algorithms algorithms = new Algorithms();
    algorithms.add(new TsFci(new FisherZ()));
    algorithms.add(new TsGfci(new FisherZ(), new SemBicScore()));
    algorithms.add(new TsImages(new SemBicScore()));
    Simulations simulations = new Simulations();
    simulations.add(new TimeSeriesSemSimulation(new RandomForward()));
    Comparison comparison = new Comparison();
    comparison.setSortByUtility(true);
    comparison.setShowUtilities(true);
    comparison.compareFromSimulations("comparison", simulations, algorithms, statistics, parameters);
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) Parameters(edu.cmu.tetrad.util.Parameters) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward) TsGfci(edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsGfci) TimeSeriesSemSimulation(edu.cmu.tetrad.algcomparison.simulation.TimeSeriesSemSimulation) Algorithms(edu.cmu.tetrad.algcomparison.algorithm.Algorithms) FisherZ(edu.cmu.tetrad.algcomparison.independence.FisherZ) Comparison(edu.cmu.tetrad.algcomparison.Comparison) TsFci(edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsFci) TsImages(edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.TsImages) SemBicScore(edu.cmu.tetrad.algcomparison.score.SemBicScore)

Aggregations

Comparison (edu.cmu.tetrad.algcomparison.Comparison)30 Parameters (edu.cmu.tetrad.util.Parameters)30 Algorithms (edu.cmu.tetrad.algcomparison.algorithm.Algorithms)24 Simulations (edu.cmu.tetrad.algcomparison.simulation.Simulations)16 RandomForward (edu.cmu.tetrad.algcomparison.graph.RandomForward)14 SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)11 SemSimulation (edu.cmu.tetrad.algcomparison.simulation.SemSimulation)6 Fges (edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.Fges)5 FisherZ (edu.cmu.tetrad.algcomparison.independence.FisherZ)5 LinearFisherModel (edu.cmu.tetrad.algcomparison.simulation.LinearFisherModel)4 LeeHastieSimulation (edu.cmu.tetrad.algcomparison.simulation.LeeHastieSimulation)3 Simulation (edu.cmu.tetrad.algcomparison.simulation.Simulation)3 FirstInflection (edu.cmu.tetrad.algcomparison.algorithm.FirstInflection)2 ConditionalGaussianSimulation (edu.cmu.tetrad.algcomparison.simulation.ConditionalGaussianSimulation)2 TimeSeriesSemSimulation (edu.cmu.tetrad.algcomparison.simulation.TimeSeriesSemSimulation)2 Algorithm (edu.cmu.tetrad.algcomparison.algorithm.Algorithm)1 StARS (edu.cmu.tetrad.algcomparison.algorithm.StARS)1 StabilitySelection (edu.cmu.tetrad.algcomparison.algorithm.StabilitySelection)1 ExternalAlgorithmBNTPc (edu.cmu.tetrad.algcomparison.algorithm.external.ExternalAlgorithmBNTPc)1 ExternalAlgorithmPcalgPc (edu.cmu.tetrad.algcomparison.algorithm.external.ExternalAlgorithmPcalgPc)1