R 使用插入符号调整XGboost参数-错误:调整参数网格应该有列

R 使用插入符号调整XGboost参数-错误:调整参数网格应该有列,r,statistics,modeling,xgboost,R,Statistics,Modeling,Xgboost,我正在使用插入符号使用“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(dp

我正在使用插入符号使用“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)
库(插入符号)
图书馆(双平行)
图书馆(dplyr)
图书馆(pROC)
图书馆(xgboost)
##创建列车/测试索引
##保持类索引
种子(42)

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