-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Update GLM notebooks #4215
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
Update GLM notebooks #4215
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #4215 +/- ##
==========================================
+ Coverage 88.91% 88.94% +0.03%
==========================================
Files 89 92 +3
Lines 14429 14800 +371
==========================================
+ Hits 12829 13164 +335
- Misses 1600 1636 +36
|
Hey @MarcoGorelli ! Yeah I think that's what you have to do to get rid of the warning until the release implementing this change 😕 I don't know when this release will happen though -- cc @OriolAbril @canyon289 Maybe another workaround is to include the posterior predictive samples into the inference data object: az.from_pymc3_predictions(
ppc, idata_orig=trace, inplace=True
) Regarding |
Ah OK, sorry - if the plan's to keep it, I'll keep it in, I've just changed - plot_posterior_predictive_glm(trace, samples=100, label="posterior predictive regression lines")
+ plot_posterior_predictive_glm(
+ trace.posterior.to_dataframe().to_dict(orient="records"),
+ samples=100,
+ label="posterior predictive regression lines",
+ ) so that it still works when using |
Actually, having looked at the source code for So, in the end, the only changes here are:
|
We should remove that function from the library and put it inside the NB because it is so specific. |
@MarcoGorelli And then remove it from the function. But before we'd need to check if it's used anywhere else. If not, remove and add to the release notes that we're deprecating it. |
I'm guessing this would be a breaking change then, wouldn't it? And is it easily replaceable with |
You make good points.
…On Fri, Nov 13, 2020, 12:03 Alexandre ANDORRA ***@***.***> wrote:
I'm guessing this would be a breaking change then, wouldn't it? And is it
easily replaceable with az.plot_hdi in your experience here @MarcoGorelli
<https://github.com/MarcoGorelli> ?
If not, I'm not sure we should deprecate it: it doesn't seem to be a
burden on maintenance for the core team and is a nice one-liner for people
using the GLM module -- which, I'm guessing, are mostly beginners and which
is why the GLM module is here in the first place
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4215 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFETGATMDME4C6MKAZKU5LSPUHBTANCNFSM4TPU7EBA>
.
|
It's used in ~ 8 notebooks, but nowhere else in the codebase
I can see the desire to make it simple, but if you then need to learn the pymc3 API the moment your model is even just slightly different (or even if it just has parameters named differently, e.g. At the moment it looks to me like it's more of a convenience function which is useful for the GLM notebooks rather than something generic which needs to be part of the public API
In this notebook at least it's easily replaceable with ax.plot(x, trace['Intercept'][None, :] + trace['x'][None, :]*x[:, None], 'k-')
ax.plot([], [], 'k-') (and an extra one line of code if you only want to select e.g. 100 samples) FWIW, my suggestion would be to either:
|
Thanks @MarcoGorelli -- your points definitely go in the deprecation column. TBH, I've never really used the GLM module but I think you and @twiecki make some good points. Since it is easily repleacable by
The first option goes against the choice we made to delegate plots and diagnostics to ArviZ. I guess the next steps then are:
Are you down for this? |
@AlexAndorra I agree with this plan. |
Sure, thanks for the discussion - should there be a DeprecationWarning before removing the function? |
Mmmh, probably. I'll defer to @twiecki on this one |
It's the right thing to do. You could add the code that replaces it to that warning (or point people to it) and open an issue that this should be removed in the next version. |
I tried running this notebook on Kaggle (as their environment has all the dependencies needed, except for watermark) but the diff shows everything as having changed, rather than showing the cell-by-cell comparisons we're used to...will look into this |
🎉 removing |
Is this ready for review now @MarcoGorelli ? |
There's still some GLM left, hopefully I can get them all done this or next week |
Hi @AlexAndorra and @twiecki - having looked at Would it be welcome if I moved it over to ArviZ, made it a little more generic (so it can work even if |
That sounds like a great plan @MarcoGorelli ! The thing with an ArviZ function is that it should be PPL-agnostic, which I think will be hard to do with So the best may be to add it to Bambi instead. Pinging @aloctavodia and @tomicapretto, as they work on this, and @ahartikainen, as he knows ArviZ very well 😉 In the meantime, we should probably keep this function in PyMC3, which would mean we'd close this PR I guess |
OK, sure! There's still some updates which I've made to these notebooks (e.g. Will ping when the GLM notebooks are ready |
Thanks @AlexAndorra for pinging us here. You are right, we plan to include (or at least discuss about including) something like @MarcoGorelli if you are interested, contributions are always welcomed in Bambi :) |
Yep, sounds good @MarcoGorelli 👌 |
closing as this will go in pymc-examples |
Currently, there's a plot which uses
plot_posterior_predictive_glm
, which isn't listed in the API, not does it appear in Arviz's API reference.I guess there plans to deprecate it? If so, I've replaced it with
az.plot_hdi
.Something I don't understand about
plot_hdi
is that if I dothen I get the warning
I find this confusing if I add a dimension (as in the example from the arviz docs) then the warning goes away, is that what users are expected to do?