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 regression #6840 #6843

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Fix regression #6840 #6843

merged 2 commits into from
Aug 2, 2023

Conversation

michaelosthege
Copy link
Member

@michaelosthege michaelosthege commented Aug 1, 2023

The tune attribute is reset by the sampling iterator.

Closes #6840

Tested locally with

import pymc

def test_issue_6840():
    with pymc.Model():
        pymc.Bernoulli('X', p=0.2)
        idata = pymc.sample(draws=3, chains=2, discard_tuned_samples=False)
    assert idata.warmup_posterior.sizes["draw"] == 1000
    assert idata.posterior.sizes["draw"] == 3
    assert idata.warmup_posterior.sizes["chain"] == 2
    assert idata.posterior.sizes["chain"] == 2

Bugfixes

  • Fixes a regression in BinaryGibbsMetropolis and CategoricalGibbsMetropolis

📚 Documentation preview 📚: https://pymc--6843.org.readthedocs.build/en/6843/

The `tune` attribute is reset by the sampling iterator.

Closes pymc-devs#6840
@michaelosthege michaelosthege self-assigned this Aug 1, 2023
@michaelosthege michaelosthege marked this pull request as ready for review August 1, 2023 22:42
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #6843 (18e5562) into main (5c600c7) will decrease coverage by 7.66%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6843      +/-   ##
==========================================
- Coverage   92.03%   84.37%   -7.66%     
==========================================
  Files          96       96              
  Lines       16378    16376       -2     
==========================================
- Hits        15074    13818    -1256     
- Misses       1304     2558    +1254     
Files Changed Coverage Δ
pymc/step_methods/metropolis.py 83.95% <ø> (-2.98%) ⬇️

... and 30 files with indirect coverage changes

@twiecki
Copy link
Member

twiecki commented Aug 2, 2023

Why no test?

@michaelosthege
Copy link
Member Author

I didn't want to increase test runtime with something that tests a non-behavior.

We could start asserting the sizes in other tests that run for all samplers though. Then we'd catch such a bug for all samplers - not just the ones impacted this time.
I'll try to pinpoint such a test case ⏳

@ricardoV94
Copy link
Member

ricardoV94 commented Aug 2, 2023

Ideally we can extend one of the tests that already runs for all samplers.

In general, the step sampler API seems quite a mess :/
This is just a symptom of it

@ricardoV94 ricardoV94 merged commit 50d056d into pymc-devs:main Aug 2, 2023
@michaelosthege michaelosthege deleted the issue-6840 branch August 2, 2023 10:32
@oscarbenjamin
Copy link

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: sample returning a different size in pymc 5.7.0
4 participants