Skip to content
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

plot_hdi raise exception when x is string (#2412) #2413

Merged
merged 10 commits into from
Feb 3, 2025

Conversation

milesalanmoore
Copy link
Contributor

@milesalanmoore milesalanmoore commented Jan 19, 2025

Description

It does not seem that categorical (str) type x values are supported by az.plot_hdi but the documentation for the function is not clear here and no exception is raised if x is type str (i.e. in the case of an ANOVA type model). Here, I've contributed the following:

For now, I prefix the PR with [WIP] to invite input on whether or not to include this lack of support for str type x in the function documentation -- and because this is my first go at contributing to a repository of this caliber...

Fixes #2412

Checklist

  • Follows official PR format
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

History

  • 2025-01-19 21:18: My own test was failing, I had misplaced the raise statement. Relocated & amended the commit with force-push to keep a concise history.

📚 Documentation preview 📚: https://arviz--2413.org.readthedocs.build/en/2413/

@milesalanmoore milesalanmoore changed the title Plothdi string x except plot_hdi exception when x is string Jan 19, 2025
@milesalanmoore milesalanmoore changed the title plot_hdi exception when x is string plot_hdi raise exception when x is string (#2412) Jan 19, 2025
@milesalanmoore milesalanmoore changed the title plot_hdi raise exception when x is string (#2412) [WIP] plot_hdi raise exception when x is string (#2412) Jan 19, 2025
@milesalanmoore milesalanmoore force-pushed the plothdi-string-x-except branch from f3b2f74 to 5a83e7b Compare January 19, 2025 21:16
Copy link

codecov bot commented Jan 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.75%. Comparing base (0fc1117) to head (c40c641).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2413       +/-   ##
===========================================
+ Coverage   68.26%   86.75%   +18.48%     
===========================================
  Files         124      124               
  Lines       12936    12938        +2     
===========================================
+ Hits         8831    11224     +2393     
+ Misses       4105     1714     -2391     

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

@amaloney
Copy link

thansk @milesalanmoore! I will try to take a look at this later this week

@milesalanmoore
Copy link
Contributor Author

Thank you, @amaloney, for your time and very thoughtful message (#2412 (comment)). I have modified the error type and message per your suggestions! Let me know what you think. I took a bit of a liberty in the error message and add a recommendation to use az.plot_forest -- but I am happy to remove this or further modify the error message.

Copy link

@amaloney amaloney left a comment

Choose a reason for hiding this comment

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

rad, thanks again for this

@amaloney amaloney changed the title [WIP] plot_hdi raise exception when x is string (#2412) plot_hdi raise exception when x is string (#2412) Feb 2, 2025
@milesalanmoore
Copy link
Contributor Author

Of course, I enjoyed contributing. Thank you for your time!

Cheers!

@amaloney amaloney merged commit 27b2052 into arviz-devs:main Feb 3, 2025
12 checks passed
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.

Categorical x apparently not supported by arviz.plot_hdi()
2 participants