我想用 RandomForest 模型的 Dalex 创建解释器,但是在尝试时出现此错误:
Error: $ operator is invalid for atomic vectors
任何人都知道如何解决这个问题?
这是我的代码:
library(DALEX)
library(ranger)
model <- ranger(Species ~ .,data = iris,probability =T,classification = T)
explanation <- explain(model,
data=iris,
y = iris$Species,
model_info = "classification",
label="Random Forest")
谢谢!
编辑:我尝试使用此代码
library(DALEX)
library(ranger)
model <- ranger(Species ~ .,iris)
model_info <- list(package = "ranger", ver = "0.12.1", type = "classification")
explanation <- explain(model,
data=iris,
y = iris$Species,
label="Random Forest")
plot(model_profile(explanation))
但这不会打印变量的影响。