使用R中的插入符号CHAID错误:Resample01的模型拟合失败:alpha2 = 0.05,alpha3 = -1,alpha4 = 0.05错误:is.factor(x)不为TRUE
尝试在插入符号中运行CHAID模型时,我收到上述错误。 只需使用CHAID函数,该模型就可以正常运行。
有什么建议吗? 代码如下:
model_weights <- ifelse(as.character(train_data$outcome) == "Sucess",
5.4,1)
model_tree_caret_cost = caret::train(outcome ~ .,
data = train_data,
method = "chaid",
#tuneGrid = tunegrid,
#costs = costs,
metric = "ROC",
weights = model_weights,
trControl = trainControl(p = 0.7,
verboseIter = T,
classProbs = T#,
#costs = costs
)#,
#tuneLength = 10
)
数据是12个因子,有序变量。