params = {}
params['learning_rate'] = 0.2
params['boosting_type'] = 'goss'
params['objective'] = 'multiclassova'
params['metric'] = ['multi_error', 'multi_logloss']
params['sub_feature'] = 0.8
params['num_leaves'] = 15
params['min_data'] = 600
params['tree_learner'] = 'voting'
params['bagging_freq'] = 3
params['num_class'] = 3
params['max_depth'] = -1
params['max_bin'] = 512
params['verbose'] = -1
params['is_unbalance'] = True
#params['lambda_l2'] = 60
aa = lgb.train(params,
d_train,
init_model = aa,
valid_sets=[d_train, d_test],
evals_result=evals_result,
num_boost_round=3000,
early_stopping_rounds = 2000,
feature_name=f_names,
verbose_eval=10,
categorical_feature=f_names)
Here above is an example from my codes. By feeding verbose_eval = 10, you will be able to print the loss metric of both the training and the test sets at every 10 iterations. You will see the point where your test loss does not decrease anymore, and afterwhile it increases, starting to overfit. Do not compare two with their loss numerically, they can differ. Moreover, by early_stopping_rounds you can make your algorithm automatically stop at a point where your loss stops decreasing. Moreover, you can plot the training and test losses that evals_result has recorded for you per iteration to see how your test losses behave in time:
lgb.plot_metric(evals_result, metric='multi_error')
plt.show()
lgb.plot_metric(evals_result, metric='multi_logloss')
plt.show()
Note: LightGBM allows us to use more than one metric, it is usually wise to monitor multiple rather than observing one. For example, multi_logloss can still keep decreasing, where multi_error starts to increase, from experience.