Skip to content

feat: add NoImprovementHandler#3760

Draft
Aanushka001 wants to merge 2 commits into
pytorch:masterfrom
Aanushka001:add-no-improvement-handler
Draft

feat: add NoImprovementHandler#3760
Aanushka001 wants to merge 2 commits into
pytorch:masterfrom
Aanushka001:add-no-improvement-handler

Conversation

@Aanushka001

Copy link
Copy Markdown

Description

Adds a NoImprovementHandler that stops training when metrics stop improving for a set number of epochs. This is a simpler alternative to the existing EarlyStopping handler.

Key Features

  • Simpler interface: Only requires patience, score_function, trainer, and optional mode parameter
  • Mode support: Works with both maximization ('max', default) and minimization ('min') objectives
  • Serializable: Supports state_dict() and load_state_dict() for checkpointing
  • Resettable: Supports reset() method for reuse across training runs
  • Attachable: Standard attach() method for easy integration with ignite engines

Changes

  • New file: ignite/handlers/no_improvement_handler.py
  • Updated: ignite/handlers/__init__.py to export NoImprovementHandler

Closes #2314

@github-actions github-actions Bot added the module: handlers Core Handlers module label May 31, 2026
@vfdev-5 vfdev-5 marked this pull request as draft May 31, 2026 19:40
@aaishwarymishra

Copy link
Copy Markdown
Collaborator

Hi, I think the issue meant this handler should take a custom function or method and execute it in case of no improvement. Currently the implementation looks a loot like early stopping instead of a modular handler.

@Aanushka001

Aanushka001 commented Jun 2, 2026 via email

Copy link
Copy Markdown
Author

@TahaZahid05

Copy link
Copy Markdown
Collaborator

@Aanushka001 have you checked the implementation of the previous PR #2574 ? It seems the issue and the PR points towards also changing EarlyStopping? Any pros and cons of both approaches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: handlers Core Handlers module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add no improvement handler (similar to early stopping handler)

3 participants