Skip to content

Fix bfmi with non-default chain_axis and draw_axis - #494

Open
anishmehta24 wants to merge 1 commit into
arviz-devs:mainfrom
anishmehta24:fix/bfmi-axes
Open

anishmehta24 wants to merge 1 commit into
arviz-devs:mainfrom
anishmehta24:fix/bfmi-axes

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

bfmi fails on arrays where the chain axis is not second to last. With draws-first energy, azs.bfmi(energy.T, chain_axis=1, draw_axis=0) raises ValueError: could not broadcast input array from shape (4,) into shape (100,) instead of returning the same values as azs.bfmi(energy). The output shape was read with the original chain_axis after the array had already been transposed to put chain and draw last, so it now uses ary.shape[-2]. Added a test with chain/draw on axes (0, 1) and (2, 0) that checks the result against the BFMI formula.

Written with help from Claude.

@codecov-commenter

codecov-commenter commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.63%. Comparing base (90b594d) to head (53dbcc7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #494   +/-   ##
=======================================
  Coverage   84.63%   84.63%           
=======================================
  Files          48       48           
  Lines        6978     6978           
=======================================
  Hits         5906     5906           
  Misses       1072     1072           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants