Skip to content

Commit

Permalink
minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabry committed Mar 5, 2024
1 parent 91e717d commit 5e4cf37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ validate_ll <- function(x) {
stop("List not allowed as input.")
} else if (anyNA(x)) {
stop("NAs not allowed in input.")
} else if (any(x==Inf)) {
} else if (any(x == Inf)) {
stop("All input values must be finite or -Inf.")
}
invisible(x)
Expand Down
4 changes: 2 additions & 2 deletions R/split_moment_matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ loo_moment_match_split <- function(x, upars, cov, total_shift, total_scaling,

# lwi_half may have NaNs if computation involves -Inf + Inf
# replace NaN log ratios with -Inf
lr<-lwi_half
lr <- lwi_half
lr[is.na(lr)] <- -Inf
is_obj_half <- suppressWarnings(importance_sampling.default(lr,
method = is_method,
Expand All @@ -110,7 +110,7 @@ loo_moment_match_split <- function(x, upars, cov, total_shift, total_scaling,

# lwi_half may have NaNs if computation involves -Inf + Inf
# replace NaN log ratios with -Inf
lr<-lwi_half + log_liki_half
lr <- lwi_half + log_liki_half
lr[is.na(lr)] <- -Inf
is_obj_f_half <- suppressWarnings(importance_sampling.default(lr,
method = is_method,
Expand Down

0 comments on commit 5e4cf37

Please sign in to comment.