Example #1
0
  /**
   * Executes the algorithm, producing (at least) a result workbench. Must be implemented in the
   * extending class.
   */
  public void execute() {
    DataModel source = getDataModel();

    if (!(source instanceof DataSet)) {
      throw new IllegalArgumentException("Expecting a rectangular data set.");
    }

    DataSet data = (DataSet) source;

    if (!data.isContinuous()) {
      throw new IllegalArgumentException("Expecting a continuous data set.");
    }

    //        Lingam_old lingam = new Lingam_old();
    //        lingam.setPruningDone(true);
    //        lingam.setAlpha(getParams().getIndTestParams().getAlpha());
    //        GraphWithParameters result = lingam.lingam(data);
    //        Graph graph = result.getGraph();

    Lingam lingam = new Lingam();
    LingamParams params = (LingamParams) getParams();
    lingam.setPruneFactor(params.getPruneFactor());
    Graph graph = lingam.search(data);

    setResultGraph(graph);

    if (getSourceGraph() != null) {
      GraphUtils.arrangeBySourceGraph(graph, getSourceGraph());
    } else {
      GraphUtils.circleLayout(graph, 200, 200, 150);
    }
  }
  /**
   * Executes the algorithm, producing (at least) a result workbench. Must be implemented in the
   * extending class.
   */
  public void execute() {
    DataModel source = getDataModel();

    if (!(source instanceof DataSet)) {
      throw new IllegalArgumentException("Expecting a rectangular data set.");
    }

    DataSet data = (DataSet) source;

    if (!data.isContinuous()) {
      throw new IllegalArgumentException("Expecting a continuous data set.");
    }

    Lingam lingam = new Lingam();
    lingam.setAlpha(getParams().getIndTestParams().getAlpha());
    lingam.setPruningDone(true);
    lingam.setAlpha(getParams().getIndTestParams().getAlpha());
    GraphWithParameters result = lingam.lingam(data);
    setResultGraph(result.getGraph());
    GraphUtils.arrangeBySourceGraph(getResultGraph(), getSourceGraph());
  }