Skip to content

Commit

Permalink
Apply suggestions from code review by jgabry
Browse files Browse the repository at this point in the history
Co-authored-by: Jonah Gabry <[email protected]>
  • Loading branch information
avehtari and jgabry authored Mar 20, 2024
1 parent 77b289a commit 36ffa4d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/loo_moment_matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ loo_moment_match_i <- function(i,
# 1. match means
trans <- shift(x, uparsi, lwi)
# gather updated quantities
quantities_i <- tryCatch(update_quantities_i(x, trans$upars, i = i,
quantities_i <- try(update_quantities_i(x, trans$upars, i = i,
orig_log_prob = orig_log_prob,
log_prob_upars = log_prob_upars,
log_lik_i_upars = log_lik_i_upars,
Expand All @@ -295,7 +295,7 @@ loo_moment_match_i <- function(i,
is_method = is_method,
...)
)
if (is_try_error(quantities_i)) {
if (inherits(quantities_i, "try-error")) {
# Stan log prob caused an exception probably due to under- or
# overflow of parameters to invalid values
break
Expand Down Expand Up @@ -325,7 +325,7 @@ loo_moment_match_i <- function(i,
is_method = is_method,
...)
)
if (is_try_error(quantities_i)) {
if (inherits(quantities_i, "try-error")) {
# Stan log prob caused an exception probably due to under- or
# overflow of parameters to invalid values
break
Expand Down Expand Up @@ -358,7 +358,7 @@ loo_moment_match_i <- function(i,
...)
)

if (is_try_error(quantities_i)) {
if (inherits(quantities_i, "try-error")) {
# Stan log prob caused an exception probably due to under- or
# overflow of parameters to invalid values
break
Expand Down

0 comments on commit 36ffa4d

Please sign in to comment.