Skip to content

Commit

Permalink
change outside times range to a warning (more reasonable)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Oct 7, 2024
1 parent 239784a commit d6b8670
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/integrated_scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ weighted_survival_score = function(loss, truth, distribution, times = NULL,
# We do not prune these requested times at all (we assume that times are
# positive, unique and sorted).
# Constant interpolation is used later to get S(t) for these time points
outside_range = !is.null(times) && all(times < min(unique_times) | times > max(unique_times))
outside_range = !is.null(times) && any(times < min(unique_times) | times > max(unique_times))
if (outside_range) {
stop("Requested times are all outside the considered evaluation range.")
warning("Some requested times are outside the considered evaluation range
(unique, sorted, test set's time points).")
}
# is `times = NULL`, use the `unique_times`
unique_times = times %??% unique_times
Expand Down

0 comments on commit d6b8670

Please sign in to comment.