Package org.encog.ml.train.strategy

Examples of org.encog.ml.train.strategy.StopTrainingStrategy.shouldStop()


    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


      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

    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

  {
    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

    Assert.assertFalse(strategy.shouldStop());
    mock.iteration();
    mock.iteration();
    mock.iteration();
    mock.iteration();
    Assert.assertTrue(strategy.shouldStop());
  }
 
  public void testGreedy()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
View Full Code Here

      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

  {
    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

    Assert.assertFalse(strategy.shouldStop());
    mock.iteration();
    mock.iteration();
    mock.iteration();
    mock.iteration();
    Assert.assertTrue(strategy.shouldStop());
  }
 
  public void testGreedy()
  {
    FeedForwardPattern pattern = new FeedForwardPattern();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.