0
我在xgboost R包中使用xgb.train()以适合分类模型。我想弄清楚什么是停止树的最佳迭代。我设置了early_stop_rounds = 6,通过观察每个迭代的指标,我可以清楚地看到,验证数据上的auc性能达到最大值,然后下降。但是,模型不会停止并继续前进,直到达到指定的圆形。xgboost R包early_stop_rounds不会触发
问题1:当验证性能开始下降时,它是在迭代中定义的最佳模型(对于给定的参数)吗?
问题2:为什么模型在验证时auc开始减少时不会停止?
问题3:如何最大化parameter = FALSE是什么意思?如果它设置为FALSE,什么会使它停止?当设置了early_stop_round时它是否必须是FALSE?
问题4:模型如何知道监视列表中的验证数据是哪一个?我见过有人用test =,eval =,validation1 = etc?
谢谢!
param<-list(
objective="binary:logistic",
booster="gbtree",
eta=0.02, #Control the learning rate
max.depth=3, #Maximum depth of the tree
subsample=0.8, #subsample ratio of the training instance
colsample_bytree=0.5 # subsample ratio of columns when constructing each tree
)
watchlist<-list(train=mtrain,validation=mtest)
sgb_model<-xgb.train(params=param, # this is the modeling parameter set above
data = mtrain,
scale_pos_weight=1,
max_delta_step=1,
missing=NA,
nthread=2,
nrounds = 500, #total run 1500 rounds
verbose=2,
early_stop_rounds=6, #if performance not improving for 6 rounds, model iteration stops
watchlist=watchlist,
maximize=FALSE,
eval.metric="auc" #Maximize AUC to evaluate model
#metric_name = 'validation-auc'
)