pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Raise when trying to sample a Multinomial variable

Open Rishab87 opened this issue 9 months ago β€’ 4 comments

Description

Added an error when trying to sample a Multinomial variable

Related Issue

  • [x] Closes #7548
  • [x] Related to #7548

Checklist

Type of change

  • [ ] New feature / enhancement
  • [x] Bug fix
  • [ ] Documentation
  • [ ] Maintenance
  • [ ] Other (please specify):

πŸ“š Documentation preview πŸ“š: https://pymc--7691.org.readthedocs.build/en/7691/

Rishab87 avatar Feb 24 '25 12:02 Rishab87

Thank You Banner] :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.

welcome[bot] avatar Feb 24 '25 12:02 welcome[bot]

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!

twiecki avatar Feb 26 '25 02:02 twiecki

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

Impacted file tree graph

@@            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:

... and 1 file with indirect coverage changes

codecov[bot] avatar Feb 26 '25 03:02 codecov[bot]

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.

ricardoV94 avatar Feb 26 '25 14:02 ricardoV94