Quantcast
Viewing all articles
Browse latest Browse all 4448

Num_boost_rounds using lgb.cv

@solly7 wrote:

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)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles