From d6b867016c7ab44b1219dd7b227dc1af2cf4093e Mon Sep 17 00:00:00 2001 From: john Date: Mon, 7 Oct 2024 12:43:55 +0300 Subject: [PATCH] change outside times range to a warning (more reasonable) --- R/integrated_scores.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/integrated_scores.R b/R/integrated_scores.R index ca936d70a..2e6b1ba2d 100644 --- a/R/integrated_scores.R +++ b/R/integrated_scores.R @@ -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