使用决策树进行预测时,我有一条错误消息,我不知道如何进行整理:
library(DMwR)
library(rpart.plot)
train <-na.omit(train)
test <-na.omit(test)
ar <- rpartXse(Survived ~ .,train)
prp(dt,type=4,extra=101)
pre <- predict(ar,test,type='class')
错误:
5.
stop(sprintf(ngettext(length(m), "factor %s has new level %s", "factor %s has new levels %s"), nm, paste(nxl[m], collapse = ", ")), domain = NA)
4.
model.frame.default(Terms, newdata, na.action = na.action, xlev = attr(object, "xlevels"))
3.
model.frame(Terms, newdata, na.action = na.action, xlev = attr(object, "xlevels"))
2.
predict.rpart(ar, test, type = "class")
1.
predict(ar, test, type = "class")
起初我认为通过NA值得我纠正,不行。
有人可以告诉我如何解释此类信息,我该如何纠正呢。
提前致谢。