Skip to content

Conversation

michaelosthege
Copy link
Member

This is one step towards refactoring of the trace backend.

PyMC supports hierarchies of samplers, which means that sampler stats are not a flat list by default.

First I moved Competence and BlockedStep to the compound module to avoid a circular import.

Second, I added a StatsBijection which can be used to flatten a list of sampler stats dicts into one dictionary.

Related: #4602

Checklist

Maintenance

  • Competence and BlockedStep were moved to the compound module.
  • A non-public StatsBijection was added.

These types follow directly from the introduction of CompoundStep.
Moving them decouples code that depends on them from the `arraystep` module.
@michaelosthege michaelosthege added the trace-backend Traces and ArviZ stuff label Jan 8, 2023
@michaelosthege michaelosthege self-assigned this Jan 8, 2023
@codecov
Copy link

codecov bot commented Jan 8, 2023

Codecov Report

Merging #6443 (20a858d) into main (434333f) will increase coverage by 8.84%.
The diff coverage is 97.72%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6443      +/-   ##
==========================================
+ Coverage   85.92%   94.77%   +8.84%     
==========================================
  Files         148      148              
  Lines       27691    27753      +62     
==========================================
+ Hits        23794    26302    +2508     
+ Misses       3897     1451    -2446     
Impacted Files Coverage Δ
pymc/step_methods/compound.py 97.43% <96.70%> (-2.57%) ⬇️
pymc/blocking.py 95.65% <100.00%> (+0.09%) ⬆️
pymc/step_methods/arraystep.py 94.52% <100.00%> (-0.22%) ⬇️
pymc/step_methods/hmc/hmc.py 92.85% <100.00%> (ø)
pymc/step_methods/hmc/nuts.py 97.29% <100.00%> (ø)
pymc/step_methods/metropolis.py 83.79% <100.00%> (+0.03%) ⬆️
pymc/step_methods/slicer.py 96.25% <100.00%> (+0.04%) ⬆️
pymc/tests/step_methods/test_compound.py 100.00% <100.00%> (ø)
pymc/sampling/parallel.py 88.42% <0.00%> (+1.05%) ⬆️
pymc/logprob/cumsum.py 100.00% <0.00%> (+3.12%) ⬆️
... and 23 more

@michaelosthege michaelosthege marked this pull request as ready for review January 8, 2023 23:11
@michaelosthege michaelosthege merged commit 3d747af into pymc-devs:main Jan 11, 2023
@michaelosthege michaelosthege deleted the flat-stats branch January 11, 2023 17:23
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.

2 participants