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

Optional McBackend support #6510

Merged
merged 4 commits into from
Mar 1, 2023
Merged

Conversation

michaelosthege
Copy link
Member

@michaelosthege michaelosthege commented Feb 8, 2023

This PR implements optional support for McBackend based trace backends.

This builds on top of the refactorings from #6475 that decoupled the pm.sampling module from BaseTrace.

I split the addition of McBackend support into two commits, the first of which makes the necessary code changes without actually adding McBackend as a dependency for the test environments just to confirm that the optional importing works.

The mcbackend.RunMeta object that is created by the make_runmeta function contains several important metadata about the current model variables. This includes information such as whether a variable is deterministic or not. Related issues:

Checklist

New features

  • pm.sample(trace=...) now accepts mcbackend.Backend instances.

@michaelosthege michaelosthege added the trace-backend Traces and ArviZ stuff label Feb 8, 2023
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #6510 (c659bc6) into main (14a10b7) will decrease coverage by 8.86%.
The diff coverage is 94.39%.

❗ Current head c659bc6 differs from pull request most recent head 345e3ce. Consider uploading reports for the commit 345e3ce to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6510      +/-   ##
==========================================
- Coverage   91.91%   83.06%   -8.86%     
==========================================
  Files          89      148      +59     
  Lines       14936    28018   +13082     
==========================================
+ Hits        13729    23272    +9543     
- Misses       1207     4746    +3539     
Impacted Files Coverage Δ
pymc/tests/sampling/test_mcmc.py 0.00% <0.00%> (ø)
pymc/tests/step_methods/hmc/test_hmc.py 98.14% <ø> (ø)
pymc/tests/step_methods/test_compound.py 0.00% <0.00%> (ø)
pymc/backends/__init__.py 74.28% <78.57%> (-21.17%) ⬇️
pymc/backends/mcbackend.py 97.08% <97.08%> (ø)
pymc/tests/backends/test_mcbackend.py 97.72% <97.72%> (ø)
pymc/sampling/mcmc.py 72.88% <100.00%> (-19.25%) ⬇️
pymc/step_methods/compound.py 96.69% <100.00%> (-1.35%) ⬇️
pymc/printing.py 19.35% <0.00%> (-68.55%) ⬇️
pymc/step_methods/slicer.py 28.75% <0.00%> (-67.50%) ⬇️
... and 90 more

@michaelosthege michaelosthege force-pushed the optional-mcb branch 2 times, most recently from c659bc6 to 68862bd Compare February 11, 2023 22:37
@ricardoV94 ricardoV94 marked this pull request as ready for review February 13, 2023 17:54
@michaelosthege michaelosthege force-pushed the optional-mcb branch 4 times, most recently from 7178efb to 0b425f5 Compare February 20, 2023 11:23
@twiecki twiecki added this to the v5.1.0 milestone Feb 20, 2023
@michaelosthege michaelosthege force-pushed the optional-mcb branch 4 times, most recently from 4e31a43 to 8f81dfa Compare February 23, 2023 00:50
@michaelosthege michaelosthege force-pushed the optional-mcb branch 4 times, most recently from 6ce32a0 to 75f7053 Compare February 26, 2023 16:50
@twiecki twiecki merged commit 1988b65 into pymc-devs:main Mar 1, 2023
@michaelosthege michaelosthege deleted the optional-mcb branch March 1, 2023 14:50
@michaelosthege
Copy link
Member Author

Whoopsie, are you aware that the last commit changed the default for situations where McBackend is installed?
I mean it works for the CI, but it might be a little risky

@twiecki
Copy link
Member

twiecki commented Mar 1, 2023

I don't think we should change the default yet.

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

Successfully merging this pull request may close these issues.

3 participants