示例#1
0
  /**
   * Calculate the error for the given method and dataset.
   *
   * @param method The method to use.
   * @param data The data to use.
   * @return The error.
   */
  public double calculateError(MLMethod method, MLDataSet data) {
    if (this.dataset.getNormHelper().getOutputColumns().size() == 1) {
      ColumnDefinition cd = this.dataset.getNormHelper().getOutputColumns().get(0);
      if (cd.getDataType() == ColumnType.nominal) {
        return EncogUtility.calculateClassificationError((MLClassification) method, data);
      }
    }

    return EncogUtility.calculateRegressionError((MLRegression) method, data);
  }
 /**
  * Calculate the error for this neural network.
  *
  * @param data The training set.
  * @return The error percentage.
  */
 @Override
 public double calculateError(final MLDataSet data) {
   return EncogUtility.calculateRegressionError(this, data);
 }