Package ai.djl.training.listener
Class EarlyStoppingListener.Builder
java.lang.Object
ai.djl.training.listener.EarlyStoppingListener.Builder
- Enclosing class:
- EarlyStoppingListener
A builder for a
EarlyStoppingListener.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aEarlyStoppingListenerwith the specified values.optEarlyStopPctImprovement(double earlyStopPctImprovement) Consider early stopping if not x% improvement, defaults to 0.optEpochPatience(int epochPatience) Stop if insufficient improvement for x epochs in a row, defaults to 0.optMaxDuration(Duration duration) Set the maximum duration a training run should take, defaults to Long.MAX_VALUE in ms.optMaxMillis(int maxMillis) Set the maximum # milliseconds a training run should take, defaults to Long.MAX_VALUE.optMinEpochs(int minEpochs) Set the minimum # epochs, defaults to 0.
-
Constructor Details
-
Builder
public Builder()Constructs aEarlyStoppingListener.Builderwith default values.
-
-
Method Details
-
optMinEpochs
Set the minimum # epochs, defaults to 0.- Parameters:
minEpochs- the minimum # epochs- Returns:
- this builder
-
optMaxDuration
Set the maximum duration a training run should take, defaults to Long.MAX_VALUE in ms.- Parameters:
duration- the maximum duration a training run should take- Returns:
- this builder
-
optMaxMillis
Set the maximum # milliseconds a training run should take, defaults to Long.MAX_VALUE.- Parameters:
maxMillis- the maximum # milliseconds a training run should take- Returns:
- this builder
-
optEarlyStopPctImprovement
Consider early stopping if not x% improvement, defaults to 0.- Parameters:
earlyStopPctImprovement- the percentage improvement to consider early stopping, must be between 0 and 100.- Returns:
- this builder
-
optEpochPatience
Stop if insufficient improvement for x epochs in a row, defaults to 0.- Parameters:
epochPatience- the number of epochs without improvement to consider stopping, must be greater than 0.- Returns:
- this builder
-
build
Builds aEarlyStoppingListenerwith the specified values.- Returns:
- a new
EarlyStoppingListener
-