-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Warning levels #309
Comments
I had a look at the existing warnings and messages. warnings:as_draws_df, no user control, controlled internally by as_draws, no control: convergence, no control: merge_chains, controlled by pareto_smooth, no control:
summarise_draws, no control: messages:startup message: thin_draws, no control: subset_draws, no control: pareto_smooth, controlled with
|
Related to this, we've been discussing with @avehtari that it would be useful if messages/warnings related to e.g. convergence diagnostics would be available when the diagnostic is printed, not just when it is calculated. One idea that we came up with would be to save the messages / warnings generated by the summary functions when calling For example:
|
Can we get some progress with this issue? Last week I did get annoyed when doing something like
with S=1000, and had to use
could be removed completely, as I did explicitly ask for draws and not iterations, but at least it would be nice to be able to suppress that without |
rOpenSci recently published a guide/recommendations about this: https://ropensci.org/blog/2024/02/06/verbosity-control-packages/ Perhaps this would be a reasonable guide to follow for |
I made a first attempt at implementing the note-style messages in summarise draws. It seems that it could be done with attributes (see example below). I'm not sure if this would be the best way, but it seems feasible with a small change to For example, the following works with my current implementation: # add to the message attribute
add_message <- function(x, msg) {
attr(x, "message") <- c(attr(x, "message"), msg)
x
}
prob_positive <- function(x) {
msg <- NULL
if (all(x > 0)) {
msg <- c(msg, "all draws are positive")
}
out <- Pr(x > 0)
out <- add_message(out, msg)
out
}
prob_negative <- function(x) {
msg <- NULL
if (all(x > 0)) {
msg <- c(msg, "no draws are negative")
}
out <- Pr(x < 0)
out <- add_message(out, msg)
out
}
summarise_draws(example_draws(), prob_positive, prob_negative)
|
Regarding possible levels or categories: Perhaps there could be different categories for different types of messages. For example:
|
I think there's a two different issues here:
Re: the first point, since R has mechanisms for capturing messages and warnings, I'd suggest using that to gather the messages within summarise_draws/etc, then attach them to the final output object at the end. We could even use message subclasses to group messages of the same type to simplify output. |
Pinging off discussion in #306, it might be good to have warning levels to set the verbosity of warnings for common things (like needing to merge chains). We would need to know:
We might then either want ordered warning levels (1, 2, ...) and/or warning categories/sub-categories that can be turned on and off via options.
The text was updated successfully, but these errors were encountered: