RandomForest错误此函数仅适用于类`(rfsrc,grow)的对象'或(RFSRC,Forest)'
我正在尝试从我的树格分类模型中生成部分依赖图。我正在使用RandomForest模型,并且正在收到一条错误消息。有人会把我指向正确的方向吗?
“部分错误(rf.model,pred.var = top_five_predictors [4],plot = false,: 此函数仅适用于类`(rfsrc,grow)''或'(rfsrc,forest)的对象
。
top_five_predictors = c("annualised_mileage", "mth_since_last_serv", "age_of_vehicle_years", "num_serv_dealer_purchased", "sched_serv_warr")
#Construct the 5 plots
library(pdp)
# Annualised Mileage
p1 <- partial(rf.model, pred.var = top_five_predictors[1], plot = FALSE, rug = TRUE, plot.engine = "ggplot2")```
I am trying to generate a partial dependance plot from my tree classification model. I am using randomForest model and I am getting an error message. Would someone point me in the right direction?
"Error in partial(rf.model, pred.var = top_five_predictors[4], plot = FALSE, :
this function only works for objects of class `(rfsrc, grow)' or '(rfsrc, forest)'
Here is an extract of my code:
top_five_predictors = c("annualised_mileage", "mth_since_last_serv", "age_of_vehicle_years", "num_serv_dealer_purchased", "sched_serv_warr")
#Construct the 5 plots
library(pdp)
# Annualised Mileage
p1 <- partial(rf.model, pred.var = top_five_predictors[1], plot = FALSE, rug = TRUE, plot.engine = "ggplot2")```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论