-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 Loo, implement improved algorithm #2730
Conversation
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.
LGTM
@@ -248,6 +247,9 @@ def loo(trace, model=None, pointwise=False, progressbar=False): | |||
pointwise: bool | |||
if True the pointwise predictive accuracy will be returned. | |||
Default False | |||
reff : float |
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.
Could this be computed within the function if not provided?
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.
Sure, we can compute it by default.
pymc3/stats.py
Outdated
reff = 1. | ||
else: | ||
eff = pm.effective_n(trace) | ||
eff_ave = sum(eff[v] for v in eff) / len(eff) |
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.
This wont work with multivariate RVs. I suggest
pm.stats.dict2pd(eff,'eff').mean()
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!
Thanks @aloctavodia! |
* update loo * small fixes * remove print * remove unused import * add to release-notes * automatic reff calculation * fix eff_ave
closes #2697
I adapted the code from https://github.com/avehtari/PSIS, the following list summarizes the changes with respect to that code:
sumlogs
withscipy.special.logsumexp
_gpinv
withscipy.stats.genpareto.ppf
but the former seems to be 5x faster, so I kept it.Regarding the changes from the user point of view: