Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recognition of tuning stat in .to_inferencedata() method #103

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

michaelosthege
Copy link
Member

@michaelosthege michaelosthege commented Jan 17, 2024

This fixes two bugs, one of which only got triggered by the first.

Since PyMC v5.7.0 the "tune" stat is sampler-wise, and named "sampler_0__tune" or similar.

However, the .to_inferencedata() implementation here was not updated, and kept looking for "tune".
When this is not available, an all-false mask was supposed to be used, but since np.repeat was used, this was just an empty array, resulting in all draws getting sliced away all the time.

The change here is two-fold:

  • 🐛 Use np.full to create the mask if no tune stat was found.
  • 🐛 Look for stats named "tune" or ending with "__tune" to be compatible with PyMC before and after 5.7.0.
  • 🔧 Added an __all__ to hide non-public parts of the .core API.
  • 🆙 Version incremented to 0.5.2

@michaelosthege michaelosthege added the bug Something isn't working label Jan 17, 2024
@michaelosthege michaelosthege self-assigned this Jan 17, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.45%. Comparing base (9fa6fb6) to head (3487ed7).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
+ Coverage   95.80%   96.45%   +0.64%     
==========================================
  Files           8        8              
  Lines         501      508       +7     
==========================================
+ Hits          480      490      +10     
+ Misses         21       18       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This restores compatibility with MCMC runs from PyMC >= 5.7.0.

Closes #102
@michaelosthege michaelosthege merged commit a0b1775 into main Jan 17, 2024
4 checks passed
@michaelosthege michaelosthege deleted the issue-102 branch January 17, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants