Add pool parameter support to Emcee model (Fix #95)#113
Add pool parameter support to Emcee model (Fix #95)#113georgebv merged 4 commits intogeorgebv:masterfrom
Conversation
Add support for the `pool` parameter in the `Emcee` model, allowing users to leverage parallel processing capabilities of `emcee.EnsembleSampler`. This enhancement enables faster chain computations, which is beneficial for large datasets or complex models. Changes: - `src/pyextremes/models/model_emcee.py`: Updated `Emcee` class to accept `pool` argument in `__init__` and pass it to `emcee.EnsembleSampler` in `fit`. - `src/pyextremes/models/models.py`: Updated `get_model` function signature and docstring. - `src/pyextremes/eva.py`: Updated `EVA.fit_model` method signature and docstring. - `tests/models/test_model_emcee.py`: Added a test case `test_fit_with_pool` to ensure `pool` is correctly passed to the sampler. - Formatted code with `ruff` and ensured PEP8 compliance.
There was a problem hiding this comment.
This fix is not related to the #95 fix, but is linked to a ruff tool check error
georgebv
left a comment
There was a problem hiding this comment.
Thank you! My only comment is about typing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #113 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 19
Lines 896 901 +5
=========================================
+ Hits 896 901 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Created `src/pyextremes/typing.py` with `PoolType` Protocol. - Updated `src/pyextremes/eva.py` to use `PoolType` in `fit_model` overload. - Updated `src/pyextremes/models/model_emcee.py` to use `PoolType` in `__init__` and `fit`. - Updated `src/pyextremes/models/models.py` to use `PoolType` in `get_model` overload. - Ran ruff and pytest.
|
Hi @georgebv , thanks for your review and comments. I've updated the codebase based on your feedback. Please let me know if the changes are correct for you now. |
- Delete [src/pyextremes/typing.py] to simplify package structure. - Move [PoolType] protocol to [src/pyextremes/models/model_emcee.py] where it is primarily utilized. - Update internal imports in [src/pyextremes/models/models.py] and [src/pyextremes/eva.py]. - Ensure PEP 8/20 compliance by co-locating typing definitions with their primary consumers.
|
@jultou-raa looks like the linter is complaining, we should be good to merge once it passes |
Sorry I did not activate the select I option when I checked. Now test should pass. |
|
@jultou-raa thank you, released in https://github.com/georgebv/pyextremes/releases/tag/v2.5.0 |
Add support for the
poolparameter in theEmceemodel, allowing users to leverage parallel processing capabilities ofemcee.EnsembleSampler.This enhancement enables faster chain computations, which is beneficial for large datasets or complex models.
Changes:
src/pyextremes/models/model_emcee.py: UpdatedEmceeclass to acceptpoolargument in__init__and pass it toemcee.EnsembleSamplerinfit.src/pyextremes/models/models.py: Updatedget_modelfunction signature and docstring.src/pyextremes/eva.py: UpdatedEVA.fit_modelmethod signature and docstring.tests/models/test_model_emcee.py: Added a test casetest_fit_with_poolto ensurepoolis correctly passed to the sampler.ruffand ensured PEP8 compliance.Fixes #95