1

我如何设置参数maximize来判断xgboost早期停止标准是 logloss 越来越差。我尝试以下示例:

library(mlbench)
library(mlr)
data(Sonar)

trainTask1 <- makeClassifTask(data = Sonar,target = "Class",positive = "R")

lrn = makeLearner("classif.xgboost", predict.type = "prob")

ps = makeParamSet(
  makeDiscreteParam("nrounds", values =1000L,tunable = FALSE),
  makeDiscreteParam("eta", values = c(0.01),tunable = FALSE),
  makeIntegerParam("max_depth", lower=1,upper=5),
  makeNumericParam("gamma", lower = 1, upper = 50),
  makeNumericParam("colsample_bytree", lower=0.1,upper=0.9),
  makeIntegerParam("min_child_weight", lower = 50, upper = 200),
  makeDiscreteParam("print.every.n", values = 3,tunable = FALSE),
  makeDiscreteParam("early.stop.round", values = 5L,tunable = FALSE),
  makeLogicalParam("maximize", default = FALSE,tunable = FALSE)
)

ctrl = makeTuneControlIrace(maxExperiments = 200L, show.irace.output = TRUE) 
rdesc = makeResampleDesc("Holdout")

res = tuneParams(lrn, task = trainTask1, resampling = rdesc,  control = ctrl , par.set = ps,measures = logloss, show.info = TRUE)

我收到以下错误:

  [Tune-x] 1: nrounds=1000; eta=0.01; max_depth=4; gamma=30.2; colsample_bytree=0.17; min_child_weight=193; print.every.n=3; early.stop.round=5; maximize=TRUE
Error in xgb.train(params, dtrain, nrounds, watchlist, verbose = verbose,  : 
  Please set maximize to note whether the model is maximizing the evaluation or not.

我认为设置maximize=FALSE足以告诉调优算法 logloss 应该最小化。但是我不能将其传递给xgb.train.

我的会话信息如下:

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mlr_2.9             stringi_1.1.1       ParamHelpers_1.8    ggplot2_2.1.0       BBmisc_1.10        
[6] mlbench_2.1-1       RevoUtilsMath_8.0.3

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.5      magrittr_1.5     splines_3.3.1    munsell_0.4.3    lattice_0.20-33  xtable_1.8-2    
 [7] colorspace_1.2-6 R6_2.1.2         stringr_1.0.0    plyr_1.8.3       dplyr_0.4.3      tools_3.3.1     
[13] parallel_3.3.1   grid_3.3.1       checkmate_1.8.1  data.table_1.9.6 gtable_0.2.0     DBI_0.4-1       
[19] htmltools_0.3.5  ggvis_0.4.2      xgboost_0.4-3    survival_2.39-4  assertthat_0.1   digest_0.6.9    
[25] irace_1.07       Matrix_1.2-6     shiny_0.13.2     mime_0.4         parallelMap_1.3  RevoUtils_10.0.1
[31] scales_0.4.0     backports_1.0.2  httpuv_1.3.3     chron_2.3-47    
4

1 回答 1

0

正如 Lars 评论的那样:这似乎是一个已知问题。根据 github上的这个问题,可以通过安装 drat repo 版本来解决。

于 2016-09-06T08:51:48.863 回答