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

Add optional support for McBackend-based trace backends #6501

Closed

Conversation

michaelosthege
Copy link
Member

@michaelosthege michaelosthege commented Feb 3, 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.

Bugfixes

  • Statsbijection.rmap can now take incomplete input dicts.

Maintenance

  • Some typing fixes.

@michaelosthege michaelosthege added enhancements trace-backend Traces and ArviZ stuff labels Feb 3, 2023
@michaelosthege michaelosthege self-assigned this Feb 3, 2023
@codecov
Copy link

codecov bot commented Feb 3, 2023

Codecov Report

Merging #6501 (19df620) into trace-refactoring (27ea781) will decrease coverage by 55.71%.
The diff coverage is 92.68%.

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##           trace-refactoring    #6501       +/-   ##
======================================================
- Coverage              94.83%   39.12%   -55.71%     
======================================================
  Files                    148      150        +2     
  Lines                  27820    27981      +161     
======================================================
- Hits                   26382    10948    -15434     
- Misses                  1438    17033    +15595     
Impacted Files Coverage Δ
pymc/tests/sampling/test_mcmc.py 0.00% <0.00%> (-98.61%) ⬇️
pymc/backends/__init__.py 62.16% <75.00%> (-33.30%) ⬇️
pymc/backends/mcbackend.py 96.34% <96.34%> (ø)
pymc/tests/backends/test_mcbackend.py 96.72% <96.72%> (ø)
pymc/sampling/mcmc.py 56.71% <100.00%> (-36.32%) ⬇️
pymc/sampling_jax.py 0.00% <0.00%> (-100.00%) ⬇️
pymc/tests/gp/test_gp.py 0.00% <0.00%> (-100.00%) ⬇️
pymc/tests/gp/test_mean.py 0.00% <0.00%> (-100.00%) ⬇️
pymc/tests/gp/test_util.py 0.00% <0.00%> (-100.00%) ⬇️
pymc/tests/ode/test_ode.py 0.00% <0.00%> (-100.00%) ⬇️
... and 99 more

@michaelosthege michaelosthege force-pushed the optional-mcb branch 4 times, most recently from f474303 to 9d088d4 Compare February 4, 2023 15:11
@michaelosthege michaelosthege marked this pull request as ready for review February 4, 2023 17:54
@michaelosthege michaelosthege marked this pull request as draft February 5, 2023 12:33
The mcmc module relies on the `"tune"` stat to figure out the number of
tune/draw iterations post sampling.
These changes remove reliance on any weird squeeze-cat magic.
@michaelosthege michaelosthege changed the base branch from main to trace-refactoring February 5, 2023 18:09
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.

1 participant