add early stopping to xgb.cv

This commit is contained in:
hetong007
2015-05-11 16:03:40 -07:00
parent 60d307c445
commit 83ace55f51
3 changed files with 70 additions and 3 deletions

View File

@@ -35,3 +35,5 @@ print ('start training with early Stopping setting')
# simply look at xgboost.py's implementation of train
bst <- xgb.train(param, dtrain, num_round, watchlist, logregobj, evalerror, maximize = FALSE,
earlyStopRound = 3)
bst <- xgb.cv(param, dtrain, num_round, nfold=5, obj=logregobj, feval = evalerror,
maximize = FALSE, earlyStopRound = 3)