Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early stopping does not working as expected when using ClassificationScoreCalculator #6237

ajan1019 opened this issue Aug 21, 2018 · 3 comments


Copy link

commented Aug 21, 2018

When I use early stopping with ClassificationScoreCalculator it terminates where it shouldn't break.

For example,

This is my LSTM architecture.

MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
//workspaces will be used for training (reduced memory and better performance)
.updater(new RmsProp(0.001))
.layer(0, new LSTM.Builder()
.layer(1, new RnnOutputLayer.Builder()

Below is my early stopping configuration.
EarlyStoppingConfiguration<MultiLayerNetwork> esConf =
new EarlyStoppingConfiguration.Builder<MultiLayerNetwork>()
new MaxEpochsTerminationCondition(10),
new ScoreImprovementEpochTerminationCondition(1))
new MaxTimeIterationTerminationCondition(10, TimeUnit.MINUTES))
.scoreCalculator(new ClassificationScoreCalculator(Evaluation.Metric.F1, testingDataSetIterator))

My output:

Completed training epoch 0
Score at epoch 0: 0.4175824175824176
Completed training epoch 1
New best model: score = 0.5755395683453237, epoch = 1 (previous: score = 0.4175824175824176, epoch = 0)
Hit epoch termination condition at epoch 1. Details: ScoreImprovementEpochTerminationCondition(maxEpochsWithNoImprovement=1, minImprovement=0.0)
Termination reason: EpochTerminationCondition
Termination details: ScoreImprovementEpochTerminationCondition(maxEpochsWithNoImprovement=1, minImprovement=0.0)
Total epochs: 2
Best epoch number: 1
Score at best epoch: 0.5755395683453237

Hope my example make it clear.
We had improvement in score(we used classification score calculator). But early stopping terminated with the reason of not improving score after one epoch.

@AlexDBlack AlexDBlack self-assigned this Aug 22, 2018


This comment has been minimized.

Copy link

commented Aug 22, 2018

Thanks for reporting: fixed here - #6242
FYI the issue was that minimize vs. maximize of scores weren't being handled correctly for termination conditions.
The fix will be available on snapshots a few hours after the PR has been merged


This comment has been minimized.

Copy link

commented Aug 28, 2018

Thanks for the fix :)


This comment has been minimized.

Copy link

commented Sep 27, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 27, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.