How to use custom cross validation folds with XGBoost

后端 未结 3 1200
栀梦
栀梦 2020-12-18 13:37

I\'m using the R wrapper for XGBoost. In the function xgb.cv, there is a folds parameter with the description

list provides a po

3条回答
  •  生来不讨喜
    2020-12-18 13:54

    This worked best for me:

    custom.folds <- caret::createFolds(data$Label, k=10, list=T)
    
    xgbcv <- xgb.cv(
      params = params
      ,data = df
      ,maximize = F
      ,prediction = T
      ,metrics = "logloss"
      ,folds = custom.folds
    )
    

提交回复
热议问题