无论我使用什么方法来构建模型(我尝试过“xgboost”、“carte”和“mlr”),似乎每当我尝试使用DALEX包时,R总是提示相同的错误:
Error in variable_response(...) : could not find function "variable_response"
下面是我的代码 (R 3.5.0):
source("https://bioconductor.org/biocLite.R")
biocLite("DALEX")
library("breakDown")
head(wine)
library("xgboost")
model_martix_train <- model.matrix(quality ~ . - 1, wine)
data_train <- xgb.DMatrix(model_martix_train, label = wine$quality)
param <- list(max_depth = 2, eta = 1, silent = 1, nthread = 2,objective = "reg:linear")
wine_xgb_model <- xgb.train(param, data_train, nrounds = 50)
wine_xgb_model
library("DALEX")
explainer_xgb <- explain(wine_xgb_model, data = model_martix_train, y = wine$quality, label = "xgboost")
explainer_xgb
sv_xgb_satisfaction_level <- variable_response(explainer_xgb, variable = "alcohol", type = "pdp")
Error in variable_response(explainer_xgb, variable = "alcohol", type = "pdp") :
could not find function "variable_response"
我还试过:
sv_xgb_satisfaction_level <- DALEX::variable_response(explainer_xgb, variable = "alcohol", type = "pdp")
Error: 'variable_response' is not an exit object in 'namespace:DALEX'
我还尝试手动下载“DALEX_1.3.0.zip" 包,并通过RStudio的Tools手动安装,但当我运行上述代码时,仍然发生相同的错误。
Did I do something wrong?
此外,我知道“survxai”有“variable_response()”,但是通过survxai构建的explainer与通过DALEX构建的explainer是 不同的。所以我也不能使用“survxai::variable_response”。我也尝试寻找DALEX的variable_response()的原始代码,但是我只找到了survxai的variable_response()。
请问我该怎么解决这个DALEX could not find function "variable_response"问题?
不尽感激!