Open TianshuGu opened 4 months ago
library(data.table) library(mlr3) library(mlr3proba) library(mlr3pipelines) library(mlr3learners) library(mlr3extralearners) library(mlr3tuning) library(mlr3benchmark) library(glmnet) library(ggplot2) library(survex) library(tidyr) library(survival) # remotes::install_github("mlr-org/mlr3filters") library(mlr3filters) data("lung", package = "survival") data <- as.data.table(lung) # data$time <- data$time / 30 # 将生存时间从天转换为月(可选) # data <- data[, lapply(.SD, function(x) ifelse(is.na(x), median(x, na.rm = TRUE), x))] # task <- TaskSurv$new(id = "lung_survival_task", backend = data,time = 'time',event = 'event') # (Base Learners) base_learners = lrns(c("surv.coxph", "surv.kaplan", "surv.cv_glmnet", "surv.xgboost")) # (Super Learner) super_learner = lrn("surv.ranger" ) # stacking stacking = ppl("stacking", base_learners = base_learners, super_learner = super_learner ) # training stacking$train(lung_task) ###This is my error message > stacking$train(lung_task) INFO [16:33:19.810] [mlr3] Applying learner 'surv.coxph' on task 'lung_survival_task' (iter 1/3) INFO [16:33:19.833] [mlr3] Applying learner 'surv.coxph' on task 'lung_survival_task' (iter 2/3) INFO [16:33:19.854] [mlr3] Applying learner 'surv.coxph' on task 'lung_survival_task' (iter 3/3) INFO [16:33:19.935] [mlr3] Applying learner 'surv.kaplan' on task 'lung_survival_task' (iter 1/3) INFO [16:33:19.946] [mlr3] Applying learner 'surv.kaplan' on task 'lung_survival_task' (iter 2/3) INFO [16:33:19.956] [mlr3] Applying learner 'surv.kaplan' on task 'lung_survival_task' (iter 3/3) INFO [16:33:20.241] [mlr3] Applying learner 'surv.cv_glmnet' on task 'lung_survival_task' (iter 1/3) INFO [16:33:20.402] [mlr3] Applying learner 'surv.cv_glmnet' on task 'lung_survival_task' (iter 2/3) INFO [16:33:20.580] [mlr3] Applying learner 'surv.cv_glmnet' on task 'lung_survival_task' (iter 3/3) INFO [16:33:20.839] [mlr3] Applying learner 'surv.xgboost' on task 'lung_survival_task' (iter 1/3) INFO [16:33:20.856] [mlr3] Applying learner 'surv.xgboost' on task 'lung_survival_task' (iter 2/3) INFO [16:33:20.871] [mlr3] Applying learner 'surv.xgboost' on task 'lung_survival_task' (iter 3/3) Error: <TaskSurv:lung_survival_task> has the following unsupported feature types: list This happened PipeOp surv.ranger's $train() In addition: Warning messages: 1: In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, : Loglik converged before variable 8 ; coefficient may be infinite. This happened PipeOp surv.coxph.surv.coxph's $train() 2: In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, : Loglik converged before variable 8 ; coefficient may be infinite. This happened PipeOp surv.coxph.surv.coxph's $train() 3: In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, : Loglik converged before variable 8 ; coefficient may be infinite. This happened PipeOp surv.coxph.surv.coxph's $train() 4: In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, : Loglik converged before variable 8 ; coefficient may be infinite. This happened PipeOp surv.coxph.surv.coxph's $train()
@jemus42
I have not done any stacking yet, but the book has a section on that so I hope that helps?
This always happened on the super learner