You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we provide example Python (and maybe R) implementations of LightGBM's objective functions which exactly match the behavior of the builtin objectives from the C++ side?
Motivation
Over the years of maintaining LightGBM, I've seen significant interest in implementing LightGBM's built-in objective functions in Python, for purposes like:
learning how LightGBM works (for people who are not comfortable with C++)
making it easier to measure the difference between custom objectives and LightGBM builtin ones
(e.g. if you have a Python function that exactly matches the builtin, then you can modify it and know any performance differences are due to your modifications)
See "References" for evidence.
Description
I am NOT proposing adding such implementations to any library that we publish.
Instead, I'm thinking of something like the following:
new directory in examples/ containing these implementations
tests that run in CI which compare the results to those calculated by the C++ side
those implementations accounting for the main concerns that confuse people:
calculating an init_score if Dataset doesn't have one
correctly using sample weights
correctly respecting boost_from_average
Things that do not necessarily need to be in scope for the first versions of implementations:
distributed training / collective operations
respect for deterministic parameter
anything related to quantized training
exact numerical precision (being within, say, 1e-6, would probably good enough to start)
References
GitHub posts that could be summarized as "how do I replicate a built-in LightGBM objective in Python"?
I agree with this proposal. But we should also note that there can be minor (numerical) differences between Python (or R) and c++ implementations that can cause slight different results.
Summary
Should we provide example Python (and maybe R) implementations of LightGBM's objective functions which exactly match the behavior of the builtin objectives from the C++ side?
Motivation
Over the years of maintaining LightGBM, I've seen significant interest in implementing LightGBM's built-in objective functions in Python, for purposes like:
See "References" for evidence.
Description
I am NOT proposing adding such implementations to any library that we publish.
Instead, I'm thinking of something like the following:
examples/
containing these implementationsinit_score
ifDataset
doesn't have oneboost_from_average
Things that do not necessarily need to be in scope for the first versions of implementations:
deterministic
parameter1e-6
, would probably good enough to start)References
GitHub posts that could be summarized as "how do I replicate a built-in LightGBM objective in Python"?
colsample_bytree != 1
#5543And Stack Overflow:
The text was updated successfully, but these errors were encountered: