-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
convenience function to help compare models using WAIC or LOO #1775
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
Conversation
@aloctavodia Catching the warnings would be the pythonic way I think. |
pymc3/stats.py
Outdated
@@ -281,10 +281,10 @@ def compare(traces, models, ic='WAIC'): | |||
Returns | |||
------- | |||
A DataFrame, ordered from lowest to highest IC. The index reflects | |||
the order in which the models are passed to this function. The columns are: | |||
the order in wich the models are passed to this function. The columns are: |
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.
typo
pymc3/stats.py
Outdated
Smaller IC indicates higher out-of-sample predictive fit ("better" model). | ||
Default WAIC. | ||
Smaller IC indicates higher out-of-sample predictive fit ("better" model). | ||
Default WAIC. |
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.
stray spaces
An example would also be good. |
…, I guess there is a more clever/pythonic solution
pymc3/stats.py
Outdated
|
||
Parameters | ||
---------- | ||
traces: list of PyMC3 traces |
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.
varname : description
@twiecki thanks for the reviews! |
This is a simple function that computes WAIC or LOO (IC) for a set of models and return a DataFrame ordered from "best" to "worse" model (in terms of the IC). It also computes other quantities like Akaike weights that can be used for example for model averaging and the standard error of the difference in IC between each model and the top-ranked model, that can help to compare and interpret IC for different models. A similar function is used extensively in the book Statistical Rethinking by Richard McElreath.
In a future PR I will add a plot based on this function (I guess it should be a separate function living inside
plots
). And I will update the notebook examples to give some details on this function and how it can helps to interpret IC (beyond the "smaller is better" rule ).One current problem with this function is that the warnings returned by waic/loo are not very useful given that the user does not know which model is returning a warning or even if there is more than one warning.
I am not sure which is the best solution here. A couple of alternatives are:
compare
, or by modifying waic/loo to return such a value.I think the second option (including the modification of waic/loo) is a better option. What do you think?