Search in sources :

Example 1 with TsFci

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

the class TsFciRunner 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() {
    if (this.knowledge == null) {
        knowledge = (IKnowledge) getParams().get("knowledge", new Knowledge2());
    }
    /*else {knowledge = this.knowledge;}*/
    Parameters searchParams = getParams();
    Parameters params = searchParams;
    // Cfci fciSearch =
    // new Cfci(getIndependenceTest(), knowledge);
    // fciSearch.setMaxIndegree(params.depth());
    // Graph graph = fciSearch.search();
    // 
    // if (knowledge.isDefaultToKnowledgeLayout()) {
    // SearchGraphUtils.arrangeByKnowledgeTiers(graph, knowledge);
    // }
    // 
    // setResultGraph(graph);
    Graph graph;
    if (params.getBoolean("rfciUsed", false)) {
        System.out.println("WARNING: there is no RFCI option for tsFCI! Just using tsFCI.");
        // Rfci fci = new Rfci(getIndependenceTest());
        TsFci fci = new TsFci(getIndependenceTest());
        fci.setKnowledge(knowledge);
        fci.setCompleteRuleSetUsed(true);
        fci.setMaxPathLength(params.getInt("maxReachablePathLength", -1));
        fci.setDepth(params.getInt("depth", -1));
        graph = fci.search();
    } else {
        TsFci fci = new TsFci(getIndependenceTest());
        fci.setKnowledge(knowledge);
        fci.setCompleteRuleSetUsed(true);
        fci.setPossibleDsepSearchDone(params.getBoolean("possibleDsepDone", true));
        fci.setMaxPathLength(params.getInt("maxReachablePathLength", -1));
        fci.setDepth(params.getInt("depth", -1));
        graph = fci.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 : Parameters(edu.cmu.tetrad.util.Parameters) TsFci(edu.cmu.tetrad.search.TsFci) Knowledge2(edu.cmu.tetrad.data.Knowledge2)

Aggregations

Knowledge2 (edu.cmu.tetrad.data.Knowledge2)1 TsFci (edu.cmu.tetrad.search.TsFci)1 Parameters (edu.cmu.tetrad.util.Parameters)1