Search in sources :

Example 1 with SemSimulation

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

the class TimeoutComparisonTest method getSimulations.

private static Simulations getSimulations() {
    Simulations simulations = new Simulations();
    simulations.add(new SemSimulation(new RandomForward()));
    return simulations;
}
Also used : Simulations(edu.cmu.tetrad.algcomparison.simulation.Simulations) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 2 with SemSimulation

use of edu.cmu.tetrad.algcomparison.simulation.SemSimulation 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 3 with SemSimulation

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

the class ExampleSave method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 10);
    parameters.set("numMeasures", 100);
    parameters.set("avgDegree", 4);
    parameters.set("sampleSize", 100, 500, 1000);
    Simulation simulation = new SemSimulation(new RandomForward());
    Comparison comparison = new Comparison();
    comparison.setShowAlgorithmIndices(true);
    comparison.saveToFiles("comparison", simulation, parameters);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) Simulation(edu.cmu.tetrad.algcomparison.simulation.Simulation) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 4 with SemSimulation

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

the class ExampleSave method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 10);
    parameters.set("numMeasures", 50, 100, 500);
    parameters.set("avgDegree", 2, 4, 6);
    parameters.set("sampleSize", 100, 500, 1000);
    parameters.set("differentGraphs", true);
    parameters.set("maxDegree", 100);
    parameters.set("maxIndegree", 100);
    parameters.set("maxOutdegree", 100);
    parameters.set("connected", false);
    parameters.set("coefLow", 0.2);
    parameters.set("coefHigh", 0.9);
    parameters.set("coefSymmetric", true);
    parameters.set("varLow", 1);
    parameters.set("varHigh", 3);
    parameters.set("randomizeColumns", true);
    NumberFormatUtil.getInstance().setNumberFormat(new DecimalFormat("0.000000"));
    Simulation simulation = new SemSimulation(new RandomForward());
    Comparison comparison = new Comparison();
    comparison.saveToFiles("/Users/user/comparison-data/condition_2", simulation, parameters);
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) Simulation(edu.cmu.tetrad.algcomparison.simulation.Simulation) Comparison(edu.cmu.tetrad.algcomparison.Comparison) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) DecimalFormat(java.text.DecimalFormat) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 5 with SemSimulation

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

the class SimulationEditor method resetPanel.

private void resetPanel(Simulation simulation, String[] graphItems, String[] simulationItems, JTabbedPane tabbedPane) {
    RandomGraph randomGraph = (simulation.getSourceGraph() == null) ? new SingleGraph(new EdgeListGraph()) : new SingleGraph(simulation.getSourceGraph());
    if (!simulation.isFixedGraph()) {
        String graphItem = (String) graphsDropdown.getSelectedItem();
        simulation.getParams().set("graphsDropdownPreference", graphItem);
        if (graphItem.equals(graphItems[0])) {
            randomGraph = new RandomForward();
        } else if (graphItem.equals(graphItems[1])) {
            randomGraph = new ScaleFree();
        } else if (graphItem.equals(graphItems[2])) {
            randomGraph = new Cyclic();
        } else if (graphItem.equals(graphItems[3])) {
            randomGraph = new RandomSingleFactorMim();
        } else if (graphItem.equals(graphItems[4])) {
            randomGraph = new RandomTwoFactorMim();
        } else {
            throw new IllegalArgumentException("Unrecognized simulation type: " + graphItem);
        }
    }
    if (!simulation.isFixedSimulation()) {
        if (simulation.getSourceGraph() == null) {
            String simulationItem = (String) simulationsDropdown.getSelectedItem();
            simulation.getParams().set("simulationsDropdownPreference", simulationItem);
            simulation.setFixedGraph(false);
            if (randomGraph instanceof SingleGraph) {
                simulation.setFixedGraph(true);
            }
            if (simulationItem.equals(simulationItems[0])) {
                simulation.setSimulation(new BayesNetSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[1])) {
                simulation.setSimulation(new SemSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[2])) {
                simulation.setSimulation(new LinearFisherModel(randomGraph, simulation.getInputDataModelList()), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[3])) {
                simulation.setSimulation(new LeeHastieSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[4])) {
                simulation.setSimulation(new ConditionalGaussianSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[5])) {
                simulation.setSimulation(new TimeSeriesSemSimulation(randomGraph), simulation.getParams());
            } else {
                throw new IllegalArgumentException("Unrecognized simulation type: " + simulationItem);
            }
        } else {
            String simulationItem = (String) simulationsDropdown.getSelectedItem();
            simulation.getParams().set("simulationsDropdownPreference", simulationItem);
            simulation.setFixedGraph(false);
            if (randomGraph instanceof SingleGraph) {
                simulation.setFixedGraph(true);
            }
            if (simulationItem.equals(simulationItems[0])) {
                simulation.setSimulation(new BayesNetSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[1])) {
                simulation.setSimulation(new SemSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[2])) {
                simulation.setSimulation(new LinearFisherModel(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[3])) {
                simulation.setSimulation(new LeeHastieSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[4])) {
                simulation.setSimulation(new ConditionalGaussianSimulation(randomGraph), simulation.getParams());
            } else if (simulationItem.equals(simulationItems[5])) {
                simulation.setSimulation(new TimeSeriesSemSimulation(randomGraph), simulation.getParams());
            } else {
                throw new IllegalArgumentException("Unrecognized simulation type: " + simulationItem);
            }
        }
    }
    tabbedPane.setComponentAt(0, new PaddingPanel(getParameterPanel(simulation, simulation.getSimulation(), simulation.getParams())));
}
Also used : LinearFisherModel(edu.cmu.tetrad.algcomparison.simulation.LinearFisherModel) RandomSingleFactorMim(edu.cmu.tetrad.algcomparison.graph.RandomSingleFactorMim) TimeSeriesSemSimulation(edu.cmu.tetrad.algcomparison.simulation.TimeSeriesSemSimulation) GeneralSemSimulation(edu.cmu.tetrad.algcomparison.simulation.GeneralSemSimulation) SemSimulation(edu.cmu.tetrad.algcomparison.simulation.SemSimulation) StandardizedSemSimulation(edu.cmu.tetrad.algcomparison.simulation.StandardizedSemSimulation) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward) EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) BayesNetSimulation(edu.cmu.tetrad.algcomparison.simulation.BayesNetSimulation) ScaleFree(edu.cmu.tetrad.algcomparison.graph.ScaleFree) TimeSeriesSemSimulation(edu.cmu.tetrad.algcomparison.simulation.TimeSeriesSemSimulation) PaddingPanel(edu.cmu.tetradapp.ui.PaddingPanel) RandomTwoFactorMim(edu.cmu.tetrad.algcomparison.graph.RandomTwoFactorMim) RandomGraph(edu.cmu.tetrad.algcomparison.graph.RandomGraph) Cyclic(edu.cmu.tetrad.algcomparison.graph.Cyclic) LeeHastieSimulation(edu.cmu.tetrad.algcomparison.simulation.LeeHastieSimulation) ConditionalGaussianSimulation(edu.cmu.tetrad.algcomparison.simulation.ConditionalGaussianSimulation) SingleGraph(edu.cmu.tetrad.algcomparison.graph.SingleGraph)

Aggregations

RandomForward (edu.cmu.tetrad.algcomparison.graph.RandomForward)7 SemSimulation (edu.cmu.tetrad.algcomparison.simulation.SemSimulation)7 Comparison (edu.cmu.tetrad.algcomparison.Comparison)4 Parameters (edu.cmu.tetrad.util.Parameters)4 Simulations (edu.cmu.tetrad.algcomparison.simulation.Simulations)3 Algorithms (edu.cmu.tetrad.algcomparison.algorithm.Algorithms)2 RandomGraph (edu.cmu.tetrad.algcomparison.graph.RandomGraph)2 FisherZ (edu.cmu.tetrad.algcomparison.independence.FisherZ)2 Simulation (edu.cmu.tetrad.algcomparison.simulation.Simulation)2 Cyclic (edu.cmu.tetrad.algcomparison.graph.Cyclic)1 RandomSingleFactorMim (edu.cmu.tetrad.algcomparison.graph.RandomSingleFactorMim)1 RandomTwoFactorMim (edu.cmu.tetrad.algcomparison.graph.RandomTwoFactorMim)1 ScaleFree (edu.cmu.tetrad.algcomparison.graph.ScaleFree)1 SingleGraph (edu.cmu.tetrad.algcomparison.graph.SingleGraph)1 SemBicDTest (edu.cmu.tetrad.algcomparison.independence.SemBicDTest)1 SemBicTest (edu.cmu.tetrad.algcomparison.independence.SemBicTest)1 SemBicScore (edu.cmu.tetrad.algcomparison.score.SemBicScore)1 BayesNetSimulation (edu.cmu.tetrad.algcomparison.simulation.BayesNetSimulation)1 ConditionalGaussianSimulation (edu.cmu.tetrad.algcomparison.simulation.ConditionalGaussianSimulation)1 GeneralSemSimulation (edu.cmu.tetrad.algcomparison.simulation.GeneralSemSimulation)1