Skip to content

Commit

Permalink
Merge pull request #324 from pbs-assess/ericward-noaa-patch-4
Browse files Browse the repository at this point in the history
Abs (gradients)
  • Loading branch information
seananderson authored Mar 19, 2024
2 parents baf8bc5 + e039d38 commit 54c57e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = F
g <- object$gradients
np <- names(object$model$par)
for (i in seq_along(g)) {
if (g[i] > gradient_thresh) {
if (abs(g[i]) > gradient_thresh) {
if (!silent) {
cli::cli_alert_danger(c(
"`", np[i],
Expand All @@ -104,7 +104,7 @@ sanity <- function(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = F
}
}

if (all(g <= gradient_thresh)) {
if (all(abs(g) <= gradient_thresh)) {
msg <- "No gradients with respect to fixed effects are >= "
if (!silent) cli::cli_alert_success(paste0(msg, gradient_thresh))
gradients_ok <- TRUE
Expand Down

0 comments on commit 54c57e5

Please sign in to comment.