In python API of LGBMClassifier, the constructor takes parameters metric and first_metric_only. Their descriptions are as follows:

first_metric_only 🔗︎, default = false, type = bool set this to true, if you want to use only the first metric for early stopping

metric 🔗︎, default = "", type = multi-enum, aliases: metrics, metric_types metric(s) to be evaluated on the evaluation set(s)

The fit method also takes an argument eval_metric whose description is:

eval_metric (string, callable, list or None, optional (default=None)) – If string, it should be a built-in evaluation metric to use. If callable, it should be a custom evaluation metric, see note below for more details. If list, it can be a list of built-in metrics, a list of custom evaluation metrics, or a mix of both. In either case, the metric from the model parameters will be evaluated and used as well. Default: ‘l2’ for LGBMRegressor, ‘logloss’ for LGBMClassifier, ‘ndcg’ for LGBMRanker.

It is not clear what they mean by first metric only. I have sent in ['auc','binary'] as value to argument metric and ['auc'] to eval_metric with first_metric_only set to True and yet it is using 'binary' for early stopping as well. I have always tried other combinations but I am not able to make clear what would happen in different scenarios

Can somebody please tell me what the exact interplay between these parameters is and what is meant by 'first metric'?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.