Repository navigation
Reduce MAD over sample_dims in summary median kinds - #496
Open
cristianchiriac wants to merge 1 commit into
Open
cristianchiriac wants to merge 1 commit into
cristianchiriac wants to merge 1 commit into
Conversation
summary(kind="stats_median" or "all_median") computed the MAD over a
hardcoded ("chain", "draw"), while the median and eti use sample_dims,
so with sample_dims=["draw"] it reported the pooled MAD for every chain.
Fixes arviz-devs#492
Documentation build overview
12 files changed ·
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #492.
summary(kind="stats_median")andkind="all_median"computed the MAD withstats.median_abs_deviation(dataset, dims=("chain", "draw"), ...), while the median and the ETI next to it reduce oversample_dims. Withsample_dims=["draw"], each chain got the MAD pooled over all chains. The MAD now usesdims=validate_dims(sample_dims), like the rest of the function.Tests in
tests/test_summary.py, using the dataset from the issue (2 chains × 4 draws):test_summary_stats_median_reduces_mad_over_sample_dimswithsample_dims="draw"and["draw"]: median[1.5, 103.0]and MAD[1.0, 2.0]. Before the change, the MAD was[50.5, 50.5].test_summary_median_kind_pools_mad_by_default: the default call still gives the pooled MAD[50.5].all_mediangoes through the same line, but it can't run withsample_dims=["draw"]because the diagnostics (r_hat) need two dims, so the test usesstats_median.ruff checkandruff format --checkare clean. Intests/test_summary.pyon my machine,test_summary_data_frame,test_rope_coords,test_ci_in_rope_default_ci_kindandtest_summary_sd_uses_sample_stdfail or error the same way with and without this change (missingtest-xarrayextras locally). Everything else passes.