Fix/optimizer initial guess provenance - #85
Open
aslansd wants to merge 3 commits into
Open
Conversation
lenarddome
self-requested a review
September 13, 2026 15:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #83.
Stores number_of_starts and adds initial_guess_supplied on Fmin, FminBound, Minimize and Bads, so the number of starts and the origin of the initial guesses are recoverable from a constructed or fitted optimiser.
reset() now uses self.number_of_starts rather than re-deriving it from initial_guess.shape[0], and sets initial_guess_supplied = False when it regenerates — since after that the guesses really are randomly drawn, whatever was passed to init. reset(initial_guess=False) leaves both alone.
33 new tests parametrised across all four optimisers; Bads skips when pybads is not installed. Docstrings updated. Black formatted.
Two things I did not assume, happy to add either: making reset() restore user-supplied guesses rather than drawing new ones (a behaviour change), and surfacing these in export().
Unrelated, noticed while testing: on SciPy ≥ 1.18 these optimisers fail with TypeError: fmin_l_bfgs_b() got an unexpected keyword argument 'disp', since SciPy removed that option in 1.18.0. I tested against SciPy 1.17. Happy to open a separate issue.