我正在尝试使用mlr,rpart& amp完成关于多分类贷款预测的教程问题。随机森林包。我确实预处理了NA&的数据。丢失的数据当我到达rpart impute部分时,impute函数只是挂起。对于我出错的地方,任何帮助都会很棒。
# Missing Value Imputation
imp <- impute(train, classes = list(factor = imputeMode(), integer = imputeMean()), dummy.classes = c("integer","factor"), dummy.type = "numeric")
imp1 <- impute(test, classes = list(factor = imputeMode(), integer = imputeMean()), dummy.classes = c("integer","factor"), dummy.type = "numeric")
rpart_num <- imputeLearner(makeLearner("regr.rpart"))
rpart_factor <- imputeLearner(makeLearner("classif.rpart"))
rpart_imp <- impute(train, target = "Loan_Status",
classes = list(numeric = rpart_num,factor = rpart_factor),
dummy.classes = c("numeric","factor"),
dummy.type = "numeric")
我之前对rpart impute的尝试是
rpart_imp <- impute(train, target = "Loan_Status",
classes = list(numeric = imputeLearner(makeLearner("regr.rpart")),
factor = imputeLearner(makeLearner("classif.rpart"))),
dummy.classes = c("numeric","factor"),
dummy.type = "numeric")