Skip to content

Fix/optimizer initial guess provenance - #85

Open
aslansd wants to merge 3 commits into
DevComPsy:mainfrom
aslansd:fix/optimizer-initial-guess-provenance
Open

Fix/optimizer initial guess provenance#85
aslansd wants to merge 3 commits into
DevComPsy:mainfrom
aslansd:fix/optimizer-initial-guess-provenance

Conversation

@aslansd

@aslansd aslansd commented Sep 12, 2026

Copy link
Copy Markdown

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.

@lenarddome
lenarddome self-requested a review September 13, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

number_of_starts and initial-guess provenance are not recoverable from a fitted optimiser

1 participant