-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
interpret
support for model predictions with response levels
#732
interpret
support for model predictions with response levels
#732
Conversation
dc15f4f
to
f53c337
Compare
The gist has been updated with demos for |
I'm trying to replicate the plot here The first thing I do is the following: plot_predictions(model, idata, ["length"]); which results in: The problem is when I try to map plot_predictions(model, idata, {"horizontal": "length", "panel": "sex"}); which results in the following error:
And if I do the following: plot_predictions(model, idata, ["length", "sex"]);
# or
plot_predictions(model, idata, ["length", "sex", "sex"]); it returns a weird result because it's mapping "sex" to color as well. And finally I tried plot_predictions(model, idata, ["length", "choice", "sex"]); but the result doesn't look good either So, my question is: why did we remove the ability to pass a dictionary to |
We removed the ability in the plot comparisons PR #684, and I described why we should remove it in this comment.
It is possible without needing to code anything. It is subtle, but since the plot functions use the columns from the summary dataframe, and if the user knows what those columns are a priori, then they can use whatever column they feel necessary for main, group, and panel. To achieve your plot bmb.interpret.plot_predictions(
model,
idata,
["length", "sex"],
subplot_kwargs={"main": "length", "group": "estimate_dim", "panel": "sex"},
fig_kwargs={"figsize": (10, 3)},
legend=True
); There is a section in plot_predictions discussing the |
@GStechschulte ha! excellent! Do you want to modify the example to use the new functionality? After that, I think it can be merged. Thanks a lot! |
For sure, I will add it. There's also a couple inline comments I want to add, and then it can be merged. Thanks! 👍🏼 |
2815c0f
to
c525787
Compare
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
This PR resolves #723 and will allow the sub-package
interpret
to work with models, such as ordinal and categorical regression, whose predictions are a vector of some quantity, e.g., probabilities.If a model's prediction is a vector of some quantity, then a series of joins are performed on the mean predictions
y_hat_mean
, uncertainty intervalbounds
, and data used to compute predictions (e.g.,cap_data
). Ultimately, the left join is used to ensure the data used to compute predictions is duplicated correctly with the predictions and uncertainty intervals.Here is a link to a Gist demonstrating the bug fix on
bmb.interpret.plot_predictions
for categorical and ordinal regression.To do:
plot_predictions
plot_comparisons
andplot_slopes
)