forester icon indicating copy to clipboard operation
forester copied to clipboard

Training for Survival Does Not Work Due To y = NULL

Open drag05 opened this issue 1 year ago • 0 comments

Seems that check_data() is y-aware and y = NULL does not work for survival training:

> train(fertility, time = 'age', status = 'diagnosis')

✔ Type guessed as: survival 
✔ Parallel processing is turned on. Registered 15 cores. 
✔ Type provided as: survival 

Error in if (!y %in% colnames(data)) { : argument is of length zero

> traceback()

2: check_data(data, y, time, status, type, verbose, check_correlation = check_correlation) at .active-rstudio-document#84
1: train(fertility, time = "age", status = "diagnosis")

Also, condition if (!y %in% colnames(data)) should be improved to cover y = NULL as, for example,

if (isTRUE((!is.null(y) && all(!colnames(data) %in% y)))) ... elseif(is.null(y)) ...

drag05 avatar Nov 27 '24 22:11 drag05