0

我正在尝试使用 mlr、rpart 和 randomforest 包完成关于多类别贷款预测的教程问题。我确实对 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")
4

0 回答 0