簡體   English   中英

使用插入符號調整 XGboost 參數 - 錯誤:調整參數網格應該有列

[英]Tuning XGboost parameters Using Caret - Error: The tuning parameter grid should have columns

我正在使用插入符號使用“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-我還想通過對使用適合每個折疊的模型所做的預測進行平均來獲得預測。

我知道這有點晚了,但是,請檢查您在調整參數網格中對 gamma 的拼寫。 您將其拼錯為 gammma(帶有三個 m)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM