【问题标题】:Tuning XGboost parameters Using Caret - Error: The tuning parameter grid should have columns使用 Caret 调整 XGboost 参数 - 错误:调整参数网格应该有列
【发布时间】:2018-06-19 20:34:54
【问题描述】:

我正在使用插入符号进行建模,使用“xgboost”

1- 但是,我收到以下错误:

"Error: The tuning parameter grid should have columns nrounds,
 max_depth, eta, gamma, colsample_bytree, min_child_weight, subsample"                          

代码:

library(caret)
library(doParallel) 
library(dplyr)        
library(pROC)               
library(xgboost)   

## Create train/test indexes
## preserve class indices
set.seed(42)
my_folds <- createFolds(train_churn$churn, k = 10)


# Compare class distribution
i <- my_folds$Fold1
table(train_churn$churn[i]) / length(i)

 my_control <- trainControl(
 summaryFunction = twoClassSummary,
 classProbs = TRUE,
 verboseIter = TRUE,
 savePredictions = TRUE,
 index = my_folds
 )

my_grid <- expand.grid(nrounds = 500,
                   max_depth = 7,
                   eta = 0.1,
                   gammma = 1,
                   colsample_bytree = 1,
                   min_child_weight = 100,
                   subsample = 1)


set.seed(42)
model_xgb <- train(
             class ~ ., data = train_churn,
             metric = "ROC",
             method =  "xgbTree",
             trControl = my_control,
             tuneGrid = my_grid)

2- 我还想通过使用适合每个折叠的模型对预测进行平均来获得预测。

【问题讨论】:

    标签: r statistics modeling xgboost


    【解决方案1】:

    我知道有点晚了,但是请检查调整参数网格中 gamma 的拼写。您将其拼写为 gammma(带有三个 m)。

    【讨论】:

      猜你喜欢
      • 2019-03-20
      • 1970-01-01
      • 2018-06-25
      • 2020-07-21
      • 2021-02-11
      • 2021-12-15
      • 1970-01-01
      • 2018-03-29
      • 2016-03-01
      相关资源
      最近更新 更多