Num_boost_rounds using lgb.cv

Hi, I am still new to machine learning. I need to find the ‘num_boost_rounds’ which i can use to train my model.
But i cant understand how to get them after running my lgb.cv function. see my code below

import lightgbm as lgb
params = {
‘objective’: ‘binary’,
‘boosting’: ‘gbdt’,
‘max_depth’:-1,
‘num_leaves’: 31, # 2^max_depth - 1
‘learning_rate’: 0.1,
‘min_data_in_leaf’:20,
‘min_child_samples’: 20,
‘min_child_weight’:0.001,
‘verbose’: 0,
}

params[‘metric’] = ‘auc’
num_rounds = 5000

lgtrain = lgb.Dataset(train, label=labelTrain)
lgvalid = lgb.Dataset(test, label=labelTest,reference=lgtrain)

cv_results = lgb.cv(params, lgtrain, nfold=5,stratified=False ,num_boost_round = num_rounds,
early_stopping_rounds = 100, metrics = {‘auc’}, seed = 50)

So my question is how do i use the ‘num_boost_rounds’ from ‘cv_results’ in the lgb.train as per below.I dont want to do parameter tuning, just baseline model only

lgb_clf = lgb.train(params, lgtrain, num_boost_round=num_rounds ,valid_sets=[lgtrain,lgvalid],early_stopping_rounds=50,verbose_eval=100)

When you do plotting of ‘auc’ it will plot against ‘num_rounds’ & looking at it you can see after point it have no change.

© Copyright 2013-2019 Analytics Vidhya