Tidymodels is an amazing package! Censored data is very common in medical research. When I was trying to tune the 'boost_tree' model using the 'censored' package, the error comes:' Unknown mode
for parsnip model.' Does it seem that 'censored regression' mode was not supported in parsnip? Very desire for solving!
library(censored)
library(survival)
library(tidymodels)
set.seed(123)
lung$surv <- Surv(lung$time, lung$status)
lung_split <- lung %>%
initial_split(strata = status )
lung_train <- training(lung_split)
lung_test <- testing(lung_split)
set.seed(123)
lung_folds <- vfold_cv(lung_train, strata = status)
lung_rec <- recipe(surv ~ age + ph.ecog, data = lung_train)
boost_spec <-
boost_tree(
mtry = tune(),
trees = tune()
) %>%
set_engine("mboost") %>%
set_mode('censored regression')
lung_grid <- crossing(mtry = c(2,3,4), trees = c(100,200,15))
lung_wf <- workflow(lung_rec, boost_spec)
set.seed(345)
tree_rs <-
tune_grid(
lung_wf,
boost_spec,
resamples = lung_folds,
grid = lung_grid
#metrics = metric_set(accuracy, roc_auc, sensitivity, specificity)
)
tree_rs