Package org.encog.ml.train.strategy

Examples of org.encog.ml.train.strategy.StopTrainingStrategy


        network, score, 10, 2, 100);

    final MLTrain trainMain = new Backpropagation(network, trainingSet,0.000001, 0.0);

    ((Propagation)trainMain).setNumThreads(1);
    final StopTrainingStrategy stop = new StopTrainingStrategy();
    trainMain.addStrategy(new Greedy());
    trainMain.addStrategy(new HybridStrategy(trainAlt));
    trainMain.addStrategy(stop);

    int epoch = 0;
    while (!stop.shouldStop()) {
      trainMain.iteration();
      System.out.println("Training " + what + ", Epoch #" + epoch
          + " Error:" + trainMain.getError());
      epoch++;
    }
View Full Code Here


    double error = Double.POSITIVE_INFINITY;
    for (int z = 0; z < this.weightTries; z++) {
      network.reset();
      final Propagation train = new ResilientPropagation(network,
          useTraining);
      final StopTrainingStrategy strat = new StopTrainingStrategy(0.001,
          5);

      train.addStrategy(strat);
      train.setNumThreads(1); // force single thread mode

      for (int i = 0; (i < this.iterations) && !getShouldStop()
          && !strat.shouldStop(); i++) {
        train.iteration();
      }

      error = Math.min(error, train.getError());
    }
View Full Code Here

        network, score, 10, 2, 100);

    final MLTrain trainMain = new Backpropagation(network, trainingSet,0.000001, 0.0);

    ((Propagation)trainMain).setNumThreads(1);
    final StopTrainingStrategy stop = new StopTrainingStrategy();
    trainMain.addStrategy(new Greedy());
    trainMain.addStrategy(new HybridStrategy(trainAlt));
    trainMain.addStrategy(stop);

    int epoch = 0;
    while (!stop.shouldStop()) {
      trainMain.iteration();
      System.out.println("Training " + what + ", Epoch #" + epoch
          + " Error:" + trainMain.getError());
      epoch++;
    }
View Full Code Here

import org.junit.Assert;

public class TestStrategy extends TestCase{
  public void testDone()
  {
    StopTrainingStrategy strategy = new StopTrainingStrategy(0.01,2);
    MockTrain mock = new MockTrain();
    mock.addStrategy(strategy);
    mock.setError(0.05);
    Assert.assertFalse(strategy.shouldStop());
    mock.iteration();
    mock.iteration();
    mock.iteration();
    mock.iteration();
    Assert.assertTrue(strategy.shouldStop());
  }
View Full Code Here

    double error = Double.POSITIVE_INFINITY;
    for (int z = 0; z < this.weightTries; z++) {
      network.reset();
      final Propagation train = new ResilientPropagation(network,
          useTraining);
      final StopTrainingStrategy strat = new StopTrainingStrategy(0.001,
          5);

      train.addStrategy(strat);
      train.setThreadCount(1); // force single thread mode

      for (int i = 0; (i < this.iterations) && !getShouldStop()
          && !strat.shouldStop(); i++) {
        train.iteration();
      }

      error = Math.min(error, train.getError());
    }
View Full Code Here

import org.junit.Assert;

public class TestStrategy extends TestCase{
  public void testDone()
  {
    StopTrainingStrategy strategy = new StopTrainingStrategy(0.01,2);
    MockTrain mock = new MockTrain();
    mock.addStrategy(strategy);
    mock.setError(0.05);
    Assert.assertFalse(strategy.shouldStop());
    mock.iteration();
    mock.iteration();
    mock.iteration();
    mock.iteration();
    Assert.assertTrue(strategy.shouldStop());
  }
View Full Code Here

TOP

Related Classes of org.encog.ml.train.strategy.StopTrainingStrategy

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.