Repository navigation
Add classes to all loo warnings - #417
florence-bockting wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #417 +/- ##
==========================================
+ Coverage 92.65% 92.92% +0.26%
==========================================
Files 31 31
Lines 3242 3251 +9
==========================================
+ Hits 3004 3021 +17
+ Misses 238 230 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if c74db6b is merged into master:
Further explanation regarding interpretation and methodology can be found in the documentation. |
jgabry
left a comment
There was a problem hiding this comment.
Looks good. I made a few suggestions, but pretty small.
jgabry
left a comment
There was a problem hiding this comment.
Looks good, this is basically ready. I made a few code formatting (indentation) comments and suggested an edit to the NEWS entry.
| if (ref_loo[[1]]$loo_subsampling$estimator == "hh_pps" | compare_loo[[1]]$loo_subsampling$estimator == "hh_pps"){ | ||
| warning("Hansen-Hurwitz estimator used. Naive diff SE is used.", call. = FALSE) | ||
| .warn_diagnostic("Hansen-Hurwitz estimator used. Naive diff SE is used.", | ||
| class = "loo_warning_subsample_naive_se") |
| } else { | ||
| warning("Negative estimate of SE, more subsampling obs. needed.", call. = FALSE) | ||
| .warn_diagnostic("Negative estimate of SE, more subsampling obs. needed.", | ||
| class = "loo_warning_subsample_negative_se") |
| warning("Negative estimate of SE, more subsampling obs. needed.", call. = FALSE) | ||
| x$estimates["elpd_loo", "SE"] <- NaN | ||
| .warn_diagnostic("Negative estimate of SE, more subsampling obs. needed.", | ||
| class = "loo_warning_subsample_negative_se") |
| ...) { | ||
| .Deprecated("psis") | ||
| .warn("'psislw' is deprecated.\nUse 'psis' instead.\nSee help(\"Deprecated\")", | ||
| class = c("loo_warning_deprecated", "deprecatedWarning")) |
| if (!is.null(log_q)) { | ||
| .Deprecated(msg = "psis_approximate_posterior() argument log_q has been changed to log_g") | ||
| .warn("psis_approximate_posterior() argument log_q has been changed to log_g", | ||
| class = c("loo_warning_deprecated", "deprecatedWarning")) |
| * All warnings now have the class `loo_warning` and a class for each cause; | ||
| diagnostics warnings have the class `loo_warning_diagnostic`. The base warning | ||
| class is now `rlang_warning` by @florence-bockting in #417 |
There was a problem hiding this comment.
| * All warnings now have the class `loo_warning` and a class for each cause; | |
| diagnostics warnings have the class `loo_warning_diagnostic`. The base warning | |
| class is now `rlang_warning` by @florence-bockting in #417 | |
| * All warnings now have the class `loo_warning` and a class for each cause, | |
| and diagnostic warnings also have the class `loo_warning_diagnostic`. The base | |
| warning class is now `rlang_warning` instead of `simpleWarning`. By | |
| @florence-bockting in #417 | |
| * Fix `loo_subsample()` with the Hansen-Hurwitz estimator setting the | |
| `elpd_loo` SE to `NaN` instead of the `p_loo` SE when the `p_loo` variance | |
| estimate is negative by @florence-bockting in #417 |
Description
This PR adds a class to each loo warning, following up on our corresponding work in the
posteriorpackage: stan-dev/posterior#470.loo_warningand a class for its cause.loo_warning_diagnostic.R/loo-package.RrlangtoImports.throw_psis_r_eff_warning()andthrow_loo_r_eff_warning()(this was dead code)This PR is related to Issue #353 (but does not fully solve it).
The PR was assisted by an LLM.