org.encog.ml.train.strategy

## Class StopTrainingStrategy

- java.lang.Object
- - org.encog.ml.train.strategy.StopTrainingStrategy

- All Implemented Interfaces:
    EndTrainingStrategy, Strategy

      public class StopTrainingStrategy
      extends Object
      implements EndTrainingStrategy

  This strategy will indicate once training is no longer improving the neural network by a specified amount, over a specified number of cycles. This allows the program to automatically determine when to stop training.
  Author:
    jheaton

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `DEFAULT_MIN_IMPROVEMENT` The default minimum improvement before training stops.
    `static int` | `DEFAULT_TOLERATE_CYCLES` The default number of cycles to tolerate.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StopTrainingStrategy()` Construct the strategy with default options.
    `StopTrainingStrategy(double minImprovement, int toleratedCycles)` Construct the strategy with the specified parameters.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `init(MLTrain train)` Initialize this strategy.
    `void` | `postIteration()` Called just after a training iteration.
    `void` | `preIteration()` Called just before a training iteration.
    `boolean` | `shouldStop()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_MIN_IMPROVEMENT

          public static final double DEFAULT_MIN_IMPROVEMENT

      The default minimum improvement before training stops.
      See Also:
        Constant Field Values

    - #### DEFAULT_TOLERATE_CYCLES

          public static final int DEFAULT_TOLERATE_CYCLES

      The default number of cycles to tolerate.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StopTrainingStrategy

          public StopTrainingStrategy()

      Construct the strategy with default options.

    - #### StopTrainingStrategy

          public StopTrainingStrategy(double minImprovement,
                              int toleratedCycles)

      Construct the strategy with the specified parameters.
      Parameters:
        `minImprovement` - The minimum accepted improvement.
        `toleratedCycles` - The number of cycles to tolerate before stopping.

  - ### Method Detail

    - #### init

          public void init(MLTrain train)

      Initialize this strategy.
      Specified by:
        `init` in interface `Strategy`
      Parameters:
        `train` - The training algorithm.

    - #### postIteration

          public void postIteration()

      Called just after a training iteration.
      Specified by:
        `postIteration` in interface `Strategy`

    - #### preIteration

          public void preIteration()

      Called just before a training iteration.
      Specified by:
        `preIteration` in interface `Strategy`

    - #### shouldStop

          public boolean shouldStop()

      Specified by:
        `shouldStop` in interface `EndTrainingStrategy`
      Returns:
        True if training should stop.

Copyright © 2014. All Rights Reserved.