예제 #1
0
  public static double calculateRegressionError(MLRegression method, MLDataSet data) {

    final ErrorCalculation errorCalculation = new ErrorCalculation();
    if (method instanceof MLContext) ((MLContext) method).clearContext();

    for (final MLDataPair pair : data) {
      final MLData actual = method.compute(pair.getInput());
      errorCalculation.updateError(
          actual.getData(), pair.getIdeal().getData(), pair.getSignificance());
    }
    return errorCalculation.calculate();
  }
  public void perform(Frame owner) {
    try {
      final InputValidationChart dialog = new InputValidationChart();

      if (dialog.process()) {
        method = dialog.getNetwork();
        training = dialog.getTrainingSet();

        if (method instanceof MLContext) ((MLContext) method).clearContext();

        ResultValidationChart chart = new ResultValidationChart();
        chart.setData(training, method);
        EncogWorkBench.getInstance()
            .getMainWindow()
            .getTabManager()
            .openModalTab(chart, "Validation");
      }
    } catch (Throwable t) {
      EncogWorkBench.displayError("An Error Occured", t);
    }
  }