microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.66k stars 3.83k forks source link

Expose `ObjectiveFunction` class to the Python API #6585

Open neNasko1 opened 3 months ago

neNasko1 commented 3 months ago

Summary

The feature in question is related to the fact that there seems to be no way to examine the (grad, hess) pair from the user facing Python API. This might as well be a documentation issue and I will be happy to contribute if that is the case.

Motivation

This will be useful for examinations in a callback or after a model has finished training - for example computing the out-of-sample feature importances of a model.

Description

I have provided a PR that outlines a minimal implementation that covers the most basic use cases that may exist. I am open to discuss further implementation and non-implementation details.

neNasko1 commented 2 months ago

I am open to discussions about surrounding details as this is a public-facing API change.