Package org.encog.ml.train.strategy.end

Examples of org.encog.ml.train.strategy.end.SimpleEarlyStoppingStrategy


  private void fitFold(int k, int foldNum, DataFold fold) {
    MLMethod method = this.createMethod();
    MLTrain train = this.createTrainer(method, fold.getTraining());

    if (train.getImplementationType() == TrainingImplementationType.Iterative) {
      SimpleEarlyStoppingStrategy earlyStop = new SimpleEarlyStoppingStrategy(
          fold.getValidation());
      train.addStrategy(earlyStop);

      StringBuilder line = new StringBuilder();
      while (!train.isTrainingDone()) {
        train.iteration();
        line.setLength(0);
        line.append("Fold #");
        line.append(foldNum);
        line.append("/");
        line.append(k);
        line.append(": Iteration #");
        line.append(train.getIteration());
        line.append(", Training Error: ");
        line.append(Format.formatDouble(train.getError(), 8));
        line.append(", Validation Error: ");
        line.append(Format.formatDouble(earlyStop.getValidationError(),
            8));
        report.report(k, foldNum, line.toString());
      }
      fold.setScore(earlyStop.getValidationError());
      fold.setMethod(method);
    } else if (train.getImplementationType() == TrainingImplementationType.OnePass) {
      train.iteration();
      double validationError = calculateError(method,
          fold.getValidation());
View Full Code Here

TOP

Related Classes of org.encog.ml.train.strategy.end.SimpleEarlyStoppingStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.