我试图找到增强模型的准确性。我的代码是这样的:
wine.boost = gbm(as.factor(wine) ~ alcohol+hue, data = italiantrain,
distribution = "multinomial", n.trees = 5000 , interaction.depth = 2)
wine.boost.testpredict = predict(wine.boost, newdata=italiantest,
n.trees =5000, type = "response")
confusionMatrix(wine.boost.testpredict, italiantrain$wine)
当我尝试这个时,我收到以下错误:
Error in confusionMatrix.default(wine.boost.trainpredict, italiantest$wine):
the data cannot have more levels than the reference
我不确定要纠正什么或我做错了什么。有什么建议么?