pymc
pymc copied to clipboard
Raise when trying to sample a Multinomial variable
Description
Added an error when trying to sample a Multinomial variable
Related Issue
- [x] Closes #7548
- [x] Related to #7548
Checklist
- [x] Checked that the pre-commit linting/style checks pass
- [x] Included tests that prove the fix is effective or that the new feature works
- [ ] Added necessary documentation (docstrings and/or example notebooks)
- [x] If you are a pro: each commit corresponds to a relevant logical change
Type of change
- [ ] New feature / enhancement
- [x] Bug fix
- [ ] Documentation
- [ ] Maintenance
- [ ] Other (please specify):
π Documentation preview π: https://pymc--7691.org.readthedocs.build/en/7691/
]
:sparkling_heart: Thanks for opening this pull request! :sparkling_heart: The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.
I ran Claude Code on this PR, this was posted by it:
I've reviewed the changes to raise an error when sampling Multinomial variables. The implementation adds a new CannotSampleRV step method that raises a clear error message when users attempt to sample these variables.\n\nThe change correctly identifies Multinomial variables during sampler setup and ensures they're handled appropriately. The test case properly verifies this behavior.\n\nThis is an important improvement that will help users understand why certain model configurations aren't supported, rather than getting unexpected or incorrect results. Nice work!
Codecov Report
Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
Project coverage is 92.66%. Comparing base (
358b825) to head (c27f286). Report is 6 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| pymc/sampling/mcmc.py | 87.50% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #7691 +/- ##
==========================================
- Coverage 92.70% 92.66% -0.05%
==========================================
Files 107 108 +1
Lines 18391 18343 -48
==========================================
- Hits 17050 16997 -53
- Misses 1341 1346 +5
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| pymc/step_methods/cannot_sample.py | 100.00% <100.00%> (ΓΈ) |
|
| pymc/sampling/mcmc.py | 86.84% <87.50%> (+0.01%) |
:arrow_up: |
I ran Claude Code on this PR, this was posted by it:
I've reviewed the changes to raise an error when sampling Multinomial variables. The implementation adds a new CannotSampleRV step method that raises a clear error message when users attempt to sample these variables.\n\nThe change correctly identifies Multinomial variables during sampler setup and ensures they're handled appropriately. The test case properly verifies this behavior.\n\nThis is an important improvement that will help users understand why certain model configurations aren't supported, rather than getting unexpected or incorrect results. Nice work!
The solution is not great yet, Claude is being too nice, which renders it useless again.