Skip to content

[Bug/Inconsistency] Please Convert Warning 'Messages' to Warnings #1039

Open
@emstruong

Description

@emstruong

Describe the bug
Some of the 'warnings' from cmdstanr are actually 'messages' and not warnings. This can be messy in Monte Carlo simulations.

cmdstanr/R/utils.R

Lines 287 to 310 in bceb482

message(
"Warning: ", num_divergences, " of ", num_draws,
" (", (base::format(round(percentage_divergences, 0), nsmall = 1)), "%)",
" transitions ended with a divergence.\n",
"See https://mc-stan.org/misc/warnings for details.\n"
)
}
}
invisible(unname(num_divergences_per_chain))
}
check_max_treedepth <- function(post_warmup_sampler_diagnostics, metadata) {
num_max_treedepths_per_chain <- NULL
if (!is.null(post_warmup_sampler_diagnostics)) {
treedepths <- posterior::extract_variable_matrix(post_warmup_sampler_diagnostics, "treedepth__")
num_max_treedepths_per_chain <- apply(treedepths, 2, function(x) sum(x >= metadata$max_treedepth))
num_max_treedepths <- sum(num_max_treedepths_per_chain)
num_draws <- length(treedepths)
if (!is.na(num_max_treedepths) && num_max_treedepths > 0) {
percentage_max_treedepths <- 100 * num_max_treedepths / num_draws
message(
"Warning: ", num_max_treedepths, " of ", num_draws, " (", (base::format(round(percentage_max_treedepths, 0), nsmall = 1)), "%)",
" transitions hit the maximum treedepth limit of ", metadata$max_treedepth,".\n",
"See https://mc-stan.org/misc/warnings for details.\n"

Expected behavior
I expected the warning messages to actually be warnings and I would really appreciate if they were warnings

Operating system
Ubuntu 22.04

CmdStanR version number
0.8.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions