错误于predict.xgb.Booster(modelFit, newdata): Feature names stored in object and newdata…
Jump to turn (9)
- 1错误于predict.xgb.Booster(modelFit, newdata): Feature names stored in object and ne
- 2怎么修改data表格里面列的顺序
- 3Grid5xgb$resid.pr <- predict(macroden.resid.xgb,as.matrix(Grid5xgb[,all.vars(for
- 4Grid5xgb$resid.pr <- predict(macroden.resid.xgb,as.matrix(Grid5xgb[,all.vars(for
- 5dataplot$predictmeancut <- cut(dataplot$k, breaks = c(-Inf,0.18, 0.35, 0.5, 0.75
- 6ggplot() + geomraster(data=Predict.macroden, aes(x=longitude, y=latitude,fill=pr
- 7Error in palette(): ! Insufficient values in manual scale. 11 needed but only 10
- 8Removed 2419401 rows containing missing values or values outside the scale range
- 9高纬度地区的大型土壤动物多吗?
- User
错误于predict.xgb.Booster(modelFit, newdata): Feature names stored in
objectandnewdataare different!View(Grid5_xgb) ##non-spatial #predict pred.pr <- predict(macro_den.xgb, Grid5_xgb, na.action = na.pass) 错误于predict.xgb.Booster(modelFit, newdata): Feature names stored in
objectandnewdataare different! 这个是什么意思? - Assistant
这个错误信息表明你在尝试使用
predict函数对newdata进行预测时,模型(macro_den.xgb)所存储的特征名称与newdata(Grid5_xgb)中的特征名称不匹配。在 XGBoost 模型中,特征名称是非常重要的,因为它们必须完全一致(包括顺序、名称、数据类型等)。如果在训练模型时使用的特征与在进行预测时使用的特征不同,就会出现如上所述的错误。
解决这个问题的步骤包括:
-
检查特征名称:确保
Grid5_xgb中的特征名称与训练 时使用的特征名称相同。你可以使用 和 (替换为实际存储模型的对象)来比较特征名称。
-