[plotting] Allow user to specify type of posterior data visualisation#680
Draft
AllenDowney wants to merge 3 commits intomainfrom
Draft
[plotting] Allow user to specify type of posterior data visualisation#680AllenDowney wants to merge 3 commits intomainfrom
AllenDowney wants to merge 3 commits intomainfrom
Conversation
- Add kind parameter: 'ribbon', 'histogram', 'spaghetti' - Add ci_kind parameter: 'hdi' or 'eti' (default 'hdi') - Add ci_prob parameter (default 0.94, matching current behavior) - Add num_samples parameter for spaghetti plots - Implement ribbon plots with HDI and ETI support - Implement histogram visualization (basic) - Implement spaghetti plot visualization - Maintain backward compatibility with hdi_prob parameter Addresses #671
- Add histogram visualization (2D heatmap) with global y-bins - Add spaghetti plot visualization with configurable num_samples - Add ETI (Equal-Tailed Interval) support in addition to HDI - Add comprehensive test suite for all visualization types - Maintain backward compatibility with hdi_prob parameter - Update BaseExperiment.plot() to pass through new parameters Addresses #671
The badge is auto-generated by pre-commit and should not be committed. Addresses #671
Collaborator
|
Thanks @AllenDowney ! Hoping to look at this very soon. Just flagging up that there might be some conflicts to resolve if #643 gets merged first. That one allows the user to decide if they are looking at things related to the posterior expectation or the posterior predictive. So these PR's are nicely complementary, but it's possible there could be some code overlap/conflicts. |
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.
Summary
This draft PR extends the plotting capabilities of CausalPy to support multiple visualization types for posterior data. The purpose of this draft PR is to discuss the API design and approach, not to finalize implementation or testing.
Currently, CausalPy only supports CI ribbon visualizations using Highest Density Intervals (HDI). This PR adds:
The API design aligns with ArviZ's naming conventions (
ci_prob,ci_kind) while maintaining backward compatibility with existing code.Fixes #671
Changes
Extended
plot_xY()function (causalpy/plot_utils.py):kindparameter:"ribbon","histogram", or"spaghetti"(default:"ribbon")ci_kindparameter:"hdi"or"eti"(default:"hdi"to match current behavior)ci_probparameter (default:0.94to match current behavior)num_samplesparameter for spaghetti plots (default:50)hdi_probparameterUpdated
BaseExperiment.plot()method (causalpy/experiments/base.py):_bayesian_plot()and_ols_plot()methodsTesting
causalpy_test.py) demonstrating all visualization typesAPI Design Rationale
kindparameter: Uses familiar naming convention from seaborn/pandasci_probandci_kindnaming: Aligns with ArviZ's naming conventions for ecosystem consistencyhdi_probcontinues to work unchangedOpen Questions for Reviewers
_bayesian_plot()methods) to explicitly accept and pass through these parameters, or is passing via**kwargssufficient?Checklist
📚 Documentation preview 📚: https://causalpy--680.org.readthedocs.build/en/680/