Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #244 +/- ##
===========================================
+ Coverage 82.55% 82.65% +0.10%
===========================================
Files 62 62
Lines 4946 5023 +77
===========================================
+ Hits 4083 4152 +69
- Misses 863 871 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
I might want to extend this to multiprocessing, since BUMPS already supports this. |
henrikjacobsenfys
left a comment
There was a problem hiding this comment.
Very nice, found no issues except a few things in the notebook:
It's using ObjBase, which we're deprecating
Yo ucould add the hash to the pooch retrieve call
|
Fixed both issues |
Sadly we don't have the replacement yet. We need a new class for these kinds of So I think we should stick with using |
damskii9992
left a comment
There was a problem hiding this comment.
I have only reviewed the notebook so far, but I feel like there is enough here to work on while I review the code.
| "\n", | ||
| " return pooch.retrieve(\n", | ||
| " url=f'https://public.esss.dk/groups/scipp/dmsc-summer-school/2025/{name}',\n", | ||
| " known_hash=known_hash,\n", |
There was a problem hiding this comment.
We should probably have a .datasets folder in easyscience to make import of data-files for tutorials easy. A tutorial really shouldn't have cells like these . . .
There was a problem hiding this comment.
You mean relying on dmsc-summer-school location or using pooch.retrieve?
There was a problem hiding this comment.
I mean something like what I have in my documentation EasyImaging branch.
A datasets module with loader functions, which loads in files from its own pooch registry.
There was a problem hiding this comment.
This, again, is a good refactoring, which needs to be done for all the tutorials, hence outside the scope of this PR. Maybe we can move it out to EasyUtils
| "ax.plot(omega, mid, '-', color='C1', label='posterior median')\n", | ||
| "ax.set(xlabel='$\\\\omega$/meV', ylabel='$I(\\\\omega)$')\n", | ||
| "ax.legend()\n", | ||
| "plt.show()" |
There was a problem hiding this comment.
This should really be hidden away by a method in easyscience to make it a simple call like:
results.plot_model(confidence_intervals = [2.5, 97.5])Or something like that in terms if the user-facing API.
There was a problem hiding this comment.
As mentioned above - we don't want the core to provide us with plotting. Users choose what plotting mechanism they use with the data they get from fitting. Hence - no plopp/matplotlib/plotly dependence in the core itself.
damskii9992
left a comment
There was a problem hiding this comment.
Comments after reading the code and not just the user-facing API.
| pytest.skip('BUMPS is not installed') | ||
|
|
||
| result = f.sample( | ||
| x=[x2D], y=[y2D], weights=[weights], samples=100, burn=20, thin=2, vectorized=True |
There was a problem hiding this comment.
What is this vectorized keyword? And since we don't expose it in our API, why do we even test for it?
There was a problem hiding this comment.
vectorized is indeed in mcmc_sample signature. It is quite important so I'll leave it as is
There was a problem hiding this comment.
Can you then add a comment to the test to explain why/what? And should it be exposed in the API?
There was a problem hiding this comment.
It is not just in sampling but in regular fitting as well. Nothing new.
But I added more comments explaining the usage cases.
Actually, come to think of it, I believe we can replace it with an |
As discussed, I'll move back to |
Integrate the squash-merged Bayesian DREAM feature from develop (PR #244) while retaining this branch's multiprocessing and pickling additions. Reconciliation notes: - Adopt develop's polymorphic `Fitter.mcmc_sample` (replaces the branch's separate `MultiFitter.sample`) and develop's API naming (`mcmc_sample`, return key `internal_bumps_object`) and input validation. - Extend `Fitter.mcmc_sample` with `chains`, `seed`, and `n_workers`, forwarding them to the BUMPS minimizer so multiprocessing works for both single- and multi-dataset fitters. - Keep the minimizer-level multiprocessing machinery: `BumpsPoolMapper`, worker helpers, cloudpickle-based problem serialization, the `chains` alias / `seed` handling, and `n_workers` wiring with mapper cleanup. - Merge the test suites: develop's mcmc_sample tests plus the branch's MP, pickling, alias, and seed tests (adapted to the mcmc_sample API). Make the n_workers subprocess test import the model by file path instead of via the shadowable `tests` namespace package. - Update the sampling benchmark tool to call `mcmc_sample`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>




A new Bayesian MCMC sampling interface. This enables users to perform posterior sampling using the BUMPS DREAM sampler directly from both the
MultiFitterand BUMPS minimizer classes.samplemethod toMultiFitterthat flattens multi-dataset arrays, resolves parameter aliases, and delegates to the minimizer’s sampling method, supporting both 1D and vectorized multi-dimensional fits.samplemethod in the BUMPS minimizer (minimizer_bumps.py) that builds a BUMPSFitProblemand runs the DREAM sampler, returning posterior draws, parameter names, sampler state, and log-probabilities.