-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply stricter .eval_time checking for dynamic survival metrics #468
Changes from 5 commits
56b5b45
cfd53d0
08db6eb
f1708f2
feda12b
b833b52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,63 @@ validate_surv_truth_list_estimate <- function(truth, | |
call = call | ||
) | ||
} | ||
|
||
all_eval_times_list <- lapply(estimate, function(x) x$.eval_time) | ||
all_eval_times <- unlist(all_eval_times_list) | ||
|
||
if (any(is.na(all_eval_times))) { | ||
cli::cli_abort( | ||
c( | ||
x = "Missing values in {.field .eval_time} are not allowed." | ||
), | ||
call = call | ||
) | ||
} | ||
|
||
if (any(all_eval_times < 0)) { | ||
offenders <- unique(all_eval_times[all_eval_times < 0]) | ||
|
||
cli::cli_abort( | ||
c( | ||
x = "Negative values of {.field .eval_time} are not allowed.", | ||
i = "The following negative values were found: {.val {offenders}}." | ||
), | ||
call = call | ||
) | ||
} | ||
|
||
if (any(is.infinite(all_eval_times))) { | ||
cli::cli_abort( | ||
c( | ||
x = "Infinite values of {.field .eval_time} are not allowed." | ||
), | ||
call = call | ||
) | ||
} | ||
|
||
any_duplicates <- any( | ||
vapply(all_eval_times_list, function(x) any(table(x) > 1), logical(1)) | ||
) | ||
if (any_duplicates) { | ||
cli::cli_abort( | ||
c( | ||
x = "Duplicate values of {.field .eval_time} are not allowed." | ||
), | ||
call = call | ||
) | ||
} | ||
|
||
any_not_in_order <- any( | ||
vapply(all_eval_times_list, function(x) is.unsorted(x), logical(1)) | ||
) | ||
if (any_not_in_order) { | ||
cli::cli_abort( | ||
c( | ||
x = "Values of {.field .eval_time} must be in increasing order." | ||
), | ||
call = call | ||
) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In tune, we explicitly make use of the order of time points in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets remove the check + add tests to make sure that out of order |
||
} | ||
|
||
validate_surv_truth_numeric_estimate <- function(truth, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍