【发布时间】:2018-08-28 20:37:57
【问题描述】:
这里是代码
library(mlr)
library(xgboost)
library(iml)
data("iris")
tsk = makeClassifTask(data = iris, target = "Species")
lrn = makeLearner("classif.xgboost",predict.type = "prob")
mod = mlr:::train(lrn, tsk)
X = iris[which(names(iris) != "Species")]
predictor = Predictor$new(mod, data = X, y = iris$Species)
imp = FeatureImp$new(predictor, loss = "ce")
我收到以下错误
imp = FeatureImp$new(predictor, loss = "ce")
Warning in predict.WrappedModel(model, newdata = newdata) :
Provided data for prediction is not a pure data.frame but from class data.table,
hence it will be converted.
estimate.feature.imp(feature, data.sample = data.sample, y = y, 中的错误: 任务 1 失败 - “存储在
object和newdata中的功能名称不同!”
我尝试检查模型和数据中的特征名称,但它们都相似。因此,我不明白这个错误到底是什么
"存储在object 和newdata 中的功能名称不同!"
colnames(X)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
mod$learner.model$feature_names
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
【问题讨论】:
-
Predictor和FeatureImp来自哪里? -
它们来自 iml 包
-
看起来像 iml 包中的一个错误——从帮助中运行示例时我也遇到了错误。你应该为此open an issue。
-
我打开了一个问题:github.com/christophM/iml/issues/46