Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Linear Tree Coefficients to get_leaf_output method #6185

Open
bammari opened this issue Nov 9, 2023 · 0 comments
Open

Add Linear Tree Coefficients to get_leaf_output method #6185

bammari opened this issue Nov 9, 2023 · 0 comments

Comments

@bammari
Copy link

bammari commented Nov 9, 2023

Summary

In the method get_leaf_output() the method does not return the coefficients and intercept when the booster is a linear-tree. Please add the linear_coeff and linear_const information to this output to avoid having to extract this information from a JSON when using the dump_model() method.

Motivation

This is useful because linear trees have been shown to be beneficial in several engineering applications. For example see [1].

Being able to extract these coefficients and intercept will allow for embedding these models within mixed-integer programming models and optimization problems. (e.g. see the Optimization & Machine Learning Toolkit [2]).

Description

Currently, the get_leaf_output() method returns a constant value, even if the booster is trained as a linear tree that is - lgb.Dataset(X, y, params = {linear_tree : True})

The get_leaf_output() method should return a list or tuple of the leaf's linear coefficients (slopes) corresponding to the number of features in the model as well as the intercept. (i.e. if leaf 1 returns y = mx + b, this get_leaf_output() should return m and b).

References

[1] Ammari et al. (2023) "Linear model decision trees as surrogates in optimization of engineering applications." Computers & Chemical Engineering 178, 108347

[2] https://github.com/cog-imperial/OMLT

@bammari bammari changed the title Add Linear Tree Coefficients to Pandas Dataframe Add Linear Tree Coefficients to get_leaf_output method Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants