小编Kev*_*Kev的帖子

如何在 R 中为 GBM 模型创建形状图?

我想为 GBM 模型创建特征重要性的形状图:

ctrlCV = trainControl(method = 'repeatedcv', repeats = 5 , number = 10 , classProbs = TRUE , savePredictions = TRUE, summaryFunction = twoClassSummary )

gbmFit = train(CR~., data = training_set,
               method = "gbm",
               metric="ROC",
               trControl = ctrlCV,
               tuneGrid = gbmGRID,
               verbose = FALSE)
Run Code Online (Sandbox Code Playgroud)

然而,我找到的所有示例都是针对 xgboost 模型、SHAPforxgboost 和 shapr 等软件包,对我不起作用。例如:

shap_values <- shap.values(xgb_model = gbm_fit, X_train = tarining_set)
Run Code Online (Sandbox Code Playgroud)

产生和错误:

error in `colnames<-`(`*tmp*`, value = c(colnames(x_train), "bias")) : attempt to set 'colnames' on an object with less than two …
Run Code Online (Sandbox Code Playgroud)

r machine-learning shap

5
推荐指数
1
解决办法
523
查看次数

标签 统计

machine-learning ×1

r ×1

shap ×1