Skip to content

Fixed minimizer behaviour on exceeded iterations#231

Open
rozyczko wants to merge 6 commits intodevelopfrom
consistent_minimizers
Open

Fixed minimizer behaviour on exceeded iterations#231
rozyczko wants to merge 6 commits intodevelopfrom
consistent_minimizers

Conversation

@rozyczko
Copy link
Copy Markdown
Member

@rozyczko rozyczko commented Apr 9, 2026

This adds improvements to the fitting result reporting and evaluation tracking across all minimizer engines, ensuring that the number of function evaluations and relevant messages are consistently captured and propagated.

  • All minimizer engines (Bumps, DFO, LMFit) now populate n_evaluations (number of function evaluations) and message (status or error message) fields in FitResults, and these fields are propagated in multi-dataset fitting.

  • The Bumps minimizer uses a new _EvalCounter wrapper to count function evaluations and detect when the maximum evaluation budget is reached, updating the success flag and message accordingly.

  • The DFO minimizer now raises FitError only for real failures, and considers both success and max function evaluation warnings as successful fits, improving error reporting and testability.

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] medium Normal/default priority labels Apr 9, 2026
Copy link
Copy Markdown
Member

@henrikjacobsenfys henrikjacobsenfys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me apart from a tiny nitpick.

This may also be a good opportunity to make a __repr__ method for the FitResults class?


assert result.success is False
assert result.n_evaluations is not None
assert result.n_evaluations > 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to check that n_evaluations matches the budget?

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

Labels

[priority] medium Normal/default priority [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants