-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Add filter
feature for var_names
#1154
Add filter
feature for var_names
#1154
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1154 +/- ##
=======================================
Coverage 93.11% 93.11%
=======================================
Files 94 94
Lines 9289 9302 +13
=======================================
+ Hits 8649 8662 +13
Misses 640 640
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! If possible, I think it would be even better to match using regular expressions (which should also work the same for most variable names).
Should we add filter_like to the other functionalities that use var_names, and not only to summary?
I would extend it to other functions, given that everything is handled by var_names
, it should not be too much work.
Should we include new tests for this feature?
Definitely. There already are some tests on _var_names
in test_plot_utils
, they should be extended to cover new cases, and as it is already tested here, there would be no need to test the behaviour in each of the plots (maybe if some does special logic to handle var_names like plot_ppc
)
Thanks for the review @OriolAbril !
Tell me if you see other necessary changes, otherwise I hope this is ready to merge 🖖 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I hope I have not repeated myself too much with previous comments
|
Renamed the |
Description
Currently, users can select variables entering
az.summary
and other plotting/diagnostics functions with thevar_names
kwarg.This selection must however be exact, meaning that if you have variables with similar names in your trace, you have to specify them all:
az.summary(idata, var_names=["alpha", "beta1", "beta2", "beta3"])
, which can be cumbersome for big models.This PR introduces the
filter_like
kwarg to allow users to select all variables containing the given word. For instance,az.summary(idata, var_names=["alpha", "beta"], filter_like=True)
would give the same result as above. This also works to exclude variables with similar names:az.summary(idata, var_names=["~beta"], filter_like=True)
filter_like
defaults toFalse
to ensure backwards-compatibility.Before adding these changes to the changelog, I had pending questions:
filter_like
to the other functionalities that usevar_names
, and not only tosummary
?I'm of course available for any changes, and thanks a lot in advances for your reviews 🖖