Skip to content

Refactoring towards IBaseTrace interfaces #6475

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

Merged
merged 4 commits into from
Feb 3, 2023

Conversation

michaelosthege
Copy link
Member

@michaelosthege michaelosthege commented Jan 23, 2023

The goal of this PR is to identify & specify the BaseTrace attributes & methods that are necessary from the perspectives of internal sampling functions (pm.sampling.mcmc.*) and MultiTrace.

By extracting these signatures/interfaces into an abstract class IBaseTrace it becomes much easier to write a small adapter class that can wrap other kinds of backends to be used instead of BaseTrace. (hint hint 🍔)

Checklist

Major / Breaking Changes

  • MultiTrace.straces type changes from Sequence[BaseTrace] to Sequence[IBaseTrace]

Maintenance

  • Internal backend types and sampling functions are refactored for more substitutability
  • Fixes flakyness of the weibull_logp test

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

codecov bot commented Jan 23, 2023

Codecov Report

Merging #6475 (b0a960b) into main (00d2675) will decrease coverage by 0.01%.
The diff coverage is 82.92%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6475      +/-   ##
==========================================
- Coverage   94.79%   94.79%   -0.01%     
==========================================
  Files         148      148              
  Lines       27730    27745      +15     
==========================================
+ Hits        26287    26301      +14     
- Misses       1443     1444       +1     
Impacted Files Coverage Δ
pymc/backends/base.py 84.97% <73.07%> (+0.15%) ⬆️
pymc/backends/__init__.py 95.45% <100.00%> (+1.33%) ⬆️
pymc/backends/ndarray.py 79.27% <100.00%> (ø)
pymc/sampling/mcmc.py 93.06% <100.00%> (ø)
pymc/tests/distributions/test_continuous.py 99.77% <100.00%> (+<0.01%) ⬆️

@michaelosthege michaelosthege force-pushed the trace-interfaces branch 4 times, most recently from 455f582 to 326a1bd Compare January 24, 2023 20:42
@michaelosthege michaelosthege marked this pull request as ready for review January 25, 2023 01:02
Copy link
Member

@aloctavodia aloctavodia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trace-backend Traces and ArviZ stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants