Skip to content

Bayesian extend/resume#257

Open
rozyczko wants to merge 13 commits into
developfrom
bayesian_extend
Open

Bayesian extend/resume#257
rozyczko wants to merge 13 commits into
developfrom
bayesian_extend

Conversation

@rozyczko

@rozyczko rozyczko commented Jun 4, 2026

Copy link
Copy Markdown
Member

Support for resuming and extending Bayesian MCMC chains using the BUMPS DREAM sampler.
Added ability to save and reload sampler state and continue chains across sessions.

  • Resume and extend MCMC chains:

    • Added resume_state parameter to mcmc_sample and sample methods in both fitter.py and minimizer_bumps.py, allowing users to continue sampling from a saved chain state. This includes documentation of the "ring-buffer contract" for extending chains without losing samples.
  • Population/chains argument resolution:

    • Introduced _resolve_population_alias method to handle both chains and population arguments, raising an error if both are set with different values, improving API clarity and preventing silent bugs.

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.87755% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.30%. Comparing base (6efc17e) to head (013e834).

Files with missing lines Patch % Lines
src/easyscience/fitting/sampler.py 92.59% 10 Missing ⚠️
.../easyscience/fitting/minimizers/minimizer_bumps.py 96.36% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #257      +/-   ##
===========================================
+ Coverage    82.92%   83.30%   +0.37%     
===========================================
  Files           62       63       +1     
  Lines         5084     5253     +169     
===========================================
+ Hits          4216     4376     +160     
- Misses         868      877       +9     
Flag Coverage Δ
integration 45.45% <89.79%> (+1.51%) ⬆️
unittests 81.00% <45.40%> (-1.42%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/easyscience/fitting/__init__.py 100.00% <100.00%> (ø)
src/easyscience/fitting/fitter.py 96.92% <ø> (-0.38%) ⬇️
src/easyscience/fitting/minimizers/__init__.py 100.00% <100.00%> (ø)
src/easyscience/fitting/multi_fitter.py 98.52% <ø> (-0.03%) ⬇️
.../easyscience/fitting/minimizers/minimizer_bumps.py 96.95% <96.36%> (+1.00%) ⬆️
src/easyscience/fitting/sampler.py 92.59% <92.59%> (ø)

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] high Should be prioritized soon labels Jun 4, 2026
@rozyczko rozyczko marked this pull request as ready for review June 8, 2026 07:51

@damskii9992 damskii9992 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just gonna stop my review here as there is already plenty to work on.
As we discussed in-person, I also think we should refactor the bayesian sampling to a seperate "samplers" module. This should help us when we add other Bayesian samplers in the future as well as provide a cleaner user API (the user doesn't create a "Fitter" when doing sampling).
It also more cleanly separates responsibility in the code. A Minimizer minimizes a function to the data, a Sampler samples the parameters to create distributions.
To avoid duplicating code, it might be smart to move shared functionality to new base-classes.

Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py Outdated
Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py Outdated
Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py Outdated
Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py Outdated
Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py Outdated
Comment thread src/easyscience/fitting/minimizers/minimizer_bumps.py
@rozyczko rozyczko requested a review from damskii9992 June 17, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] high Should be prioritized soon [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants