Search in sources :

Example 26 with Parameters

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

the class CeFanSearchRunner method execute.

// =================PUBLIC METHODS OVERRIDING ABSTRACT=================//
/**
 * Executes the algorithm, producing (at least) a result workbench. Must be
 * implemented in the extending class.
 */
public void execute() {
    int pcDepth = getParams().getInt("depth", -1);
    Cefs search = new Cefs(getIndependenceTest(), pcDepth);
    Parameters params = getParams();
    if (params instanceof Parameters) {
        search.setAggressivelyPreventCycles(params.getBoolean("aggressivelyPreventCycles", false));
    }
    String targetName = getParams().getString("targetName", null);
    Graph graph = search.search(targetName);
    setResultGraph(graph);
    if (getSourceGraph() != null) {
        GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
    } else if (((IKnowledge) getParams().get("knowledge", new Knowledge2())).isDefaultToKnowledgeLayout()) {
        SearchGraphUtils.arrangeByKnowledgeTiers(graph, (IKnowledge) getParams().get("knowledge", new Knowledge2()));
    } else {
        GraphUtils.circleLayout(graph, 200, 200, 150);
    }
}
Also used : Cefs(edu.cmu.tetrad.search.Cefs) IKnowledge(edu.cmu.tetrad.data.IKnowledge) Parameters(edu.cmu.tetrad.util.Parameters) Knowledge2(edu.cmu.tetrad.data.Knowledge2)

Example 27 with Parameters

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

the class CpcLocalRunner method execute.

// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
    IKnowledge knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
    IndependenceTest independenceTest = getIndependenceTest();
    Parameters testParams = getParams();
    CpcLocal search = new CpcLocal(independenceTest);
    search.setAggressivelyPreventCycles(isAggressivelyPreventCycles());
    search.setKnowledge(knowledge);
    Graph graph = search.search();
    if (getSourceGraph() != null) {
        GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
    } else if (knowledge.isDefaultToKnowledgeLayout()) {
        SearchGraphUtils.arrangeByKnowledgeTiers(graph, knowledge);
    } else {
        GraphUtils.circleLayout(graph, 200, 200, 150);
    }
    setResultGraph(graph);
}
Also used : IKnowledge(edu.cmu.tetrad.data.IKnowledge) Parameters(edu.cmu.tetrad.util.Parameters) Knowledge2(edu.cmu.tetrad.data.Knowledge2)

Example 28 with Parameters

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

the class InverseCorrelationRunner method execute.

// ===================PUBLIC METHODS OVERRIDING ABSTRACT================//
public void execute() {
    Object dataModel = getDataModel();
    if (dataModel instanceof DataSet) {
        DataSet dataSet = (DataSet) dataModel;
        Parameters params = getParams();
        InverseCorrelation search = new InverseCorrelation(dataSet, params.getDouble("thr", 1e-4));
        Graph graph = search.search();
        setResultGraph(graph);
    }
}
Also used : Parameters(edu.cmu.tetrad.util.Parameters) Graph(edu.cmu.tetrad.graph.Graph) DataSet(edu.cmu.tetrad.data.DataSet) InverseCorrelation(edu.cmu.tetrad.search.InverseCorrelation)

Example 29 with Parameters

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

the class Save method main.

public static void main(String... args) {
    Parameters parameters = new Parameters();
    parameters.set("numRuns", 10);
    parameters.set("numMeasures", 50, 100);
    parameters.set("avgDegree", 4);
    parameters.set("sampleSize", 100, 500);
    parameters.set("numCategories", 3);
    parameters.set("percentDiscrete", 50);
    parameters.set("differentGraphs", true);
    Simulation simulation = new LeeHastieSimulation(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) LeeHastieSimulation(edu.cmu.tetrad.algcomparison.simulation.LeeHastieSimulation) LeeHastieSimulation(edu.cmu.tetrad.algcomparison.simulation.LeeHastieSimulation) Comparison(edu.cmu.tetrad.algcomparison.Comparison) RandomForward(edu.cmu.tetrad.algcomparison.graph.RandomForward)

Example 30 with Parameters

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

the class AbstractSearchEditor method storeLatestWorkbenchGraph.

void storeLatestWorkbenchGraph() {
    Graph latestWorkbenchGraph = workbench.getGraph();
    if (latestWorkbenchGraph.getNumNodes() == 0) {
        return;
    }
    Parameters searchParams = algorithmRunner.getParams();
    try {
        Graph graph = new MarshalledObject<>(latestWorkbenchGraph).get();
        if (graph == null) {
            throw new NullPointerException("Null graph");
        }
        if (searchParams != null) {
            searchParams.set("sourceGraph", graph);
        }
    } catch (IOException e) {
        e.printStackTrace();
        if (searchParams != null) {
            searchParams.set("sourceGraph", (Graph) null);
        }
    } catch (ClassNotFoundException e) {
        if (searchParams != null) {
            searchParams.set("sourceGraph", (Graph) null);
        }
        e.printStackTrace();
    }
}
Also used : EdgeListGraph(edu.cmu.tetrad.graph.EdgeListGraph) Graph(edu.cmu.tetrad.graph.Graph) Parameters(edu.cmu.tetrad.util.Parameters) IOException(java.io.IOException)

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