Search in sources :

Example 6 with TestType

use of edu.cmu.tetrad.search.TestType in project tetrad by cmu-phil.

the class Fofc method search.

@Override
public Graph search(DataModel dataSet, Parameters parameters) {
    if (parameters.getInt("bootstrapSampleSize") < 1) {
        ICovarianceMatrix cov = DataUtils.getCovMatrix(dataSet);
        double alpha = parameters.getDouble("alpha");
        boolean wishart = parameters.getBoolean("useWishart", true);
        TestType testType;
        if (wishart) {
            testType = TestType.TETRAD_WISHART;
        } else {
            testType = TestType.TETRAD_DELTA;
        }
        boolean gap = parameters.getBoolean("useGap", true);
        FindOneFactorClusters.Algorithm algorithm;
        if (gap) {
            algorithm = FindOneFactorClusters.Algorithm.GAP;
        } else {
            algorithm = FindOneFactorClusters.Algorithm.SAG;
        }
        edu.cmu.tetrad.search.FindOneFactorClusters search = new edu.cmu.tetrad.search.FindOneFactorClusters(cov, testType, algorithm, alpha);
        search.setVerbose(parameters.getBoolean("verbose"));
        return search.search();
    } else {
        Fofc algorithm = new Fofc();
        // algorithm.setKnowledge(knowledge);
        // if (initialGraph != null) {
        // algorithm.setInitialGraph(initialGraph);
        // }
        DataSet data = (DataSet) dataSet;
        GeneralBootstrapTest search = new GeneralBootstrapTest(data, algorithm, parameters.getInt("bootstrapSampleSize"));
        search.setKnowledge(knowledge);
        BootstrapEdgeEnsemble edgeEnsemble = BootstrapEdgeEnsemble.Highest;
        switch(parameters.getInt("bootstrapEnsemble", 1)) {
            case 0:
                edgeEnsemble = BootstrapEdgeEnsemble.Preserved;
                break;
            case 1:
                edgeEnsemble = BootstrapEdgeEnsemble.Highest;
                break;
            case 2:
                edgeEnsemble = BootstrapEdgeEnsemble.Majority;
        }
        search.setEdgeEnsemble(edgeEnsemble);
        search.setParameters(parameters);
        search.setVerbose(parameters.getBoolean("verbose"));
        return search.search();
    }
}
Also used : GeneralBootstrapTest(edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest) BootstrapEdgeEnsemble(edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble) TestType(edu.cmu.tetrad.search.TestType) FindOneFactorClusters(edu.cmu.tetrad.search.FindOneFactorClusters) FindOneFactorClusters(edu.cmu.tetrad.search.FindOneFactorClusters)

Aggregations

TestType (edu.cmu.tetrad.search.TestType)6 ArrayList (java.util.ArrayList)3 Graph (edu.cmu.tetrad.graph.Graph)2 Node (edu.cmu.tetrad.graph.Node)2 FindOneFactorClusters (edu.cmu.tetrad.search.FindOneFactorClusters)2 DoubleTextField (edu.cmu.tetradapp.util.DoubleTextField)2 BootstrapEdgeEnsemble (edu.pitt.dbmi.algo.bootstrap.BootstrapEdgeEnsemble)2 GeneralBootstrapTest (edu.pitt.dbmi.algo.bootstrap.GeneralBootstrapTest)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 MarshalledObject (java.rmi.MarshalledObject)2 List (java.util.List)2 DataModel (edu.cmu.tetrad.data.DataModel)1 DataSet (edu.cmu.tetrad.data.DataSet)1 ICovarianceMatrix (edu.cmu.tetrad.data.ICovarianceMatrix)1 BuildPureClusters (edu.cmu.tetrad.search.BuildPureClusters)1 FindTwoFactorClusters (edu.cmu.tetrad.search.FindTwoFactorClusters)1 DataWrapper (edu.cmu.tetradapp.model.DataWrapper)1