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

[LightGBM] [Warning] Unknown parameter: linear_tree #3910

Closed
flippercy opened this issue Feb 4, 2021 · 8 comments
Closed

[LightGBM] [Warning] Unknown parameter: linear_tree #3910

flippercy opened this issue Feb 4, 2021 · 8 comments

Comments

@flippercy
Copy link

I am using lightgbm via reticulate in R:

parameters = {
'objective': 'binary',
'linear_tree': 'true',
'tree_learner': 'serial',
'metric': 'auc',
'n_jobs': 12,
'seed': 19850606,
'boosting': 'gbdt',
'num_leaves': 31,
'learning_rate': 0.05,
'verbose': 1,
'monotone_constraints': lightGBM_monotoneVector,
'monotone_constraints_method':'advanced'

}

lightgbm_model = lgb.train(parameters,
train_data,
valid_sets=test_data,
num_boost_round=500,
early_stopping_rounds=50)

However, I got a warning:

[LightGBM] [Warning] Unknown parameter: linear_tree

What is the reason? I know that linear_tree is not available in the R library of lightGBM but here I am using the python package via reticulate.

Thank you.

@StrikerRUS
Copy link
Collaborator

StrikerRUS commented Feb 4, 2021

Hi @flippercy !

Linear trees are not included in the latest release. Refer to #3299 (comment) for workaround.

@jameslamb
Copy link
Collaborator

@flippercy by the way, linear trees are available in the R package. Just not released to CRAN yet.

You can see

test_that("lgb.cv() fit on linearly-relatead data improves when using linear learners", {
for a usage example, and https://github.com/microsoft/LightGBM/blob/master/R-package/README.md#installation for details on how to build the R package from source.

In the future, if you find yourself turning to {reticulate} because the R package is missing something, could you please open a feature request here? It is hard for us to keep up with the full list of differences between R and Python, so that kind of feature request is very helpful.

@flippercy
Copy link
Author

Thank you both! I will try the methods you suggested while waiting for the next official release!

@flippercy
Copy link
Author

flippercy commented Feb 5, 2021

Hi @jameslamb, just to confirm - does monotone_constraints work with linear_tree? (I believe so but want to double check).

Thank you!

@jameslamb
Copy link
Collaborator

I think @btrotta is better-qualified to answer that question than I am.

@btrotta
Copy link
Collaborator

btrotta commented Feb 8, 2021

@flippercy It is not possible to enforce monotone constraints when using linear tree. This is because the linear models are fitted on each leaf after the whole tree is constructed, and we do not take monotone constraints into account when fitting the linear models.

However, you can still use monotone constraints when linear_tree is true, and the constraints will be taken into account when choosing the tree split points. As noted above, in general the resulting linear tree will not be monotone, but it will probably be "closer to" monotone than it would be otherwise.

@flippercy
Copy link
Author

@btrotta thank you for the response!

@jameslamb can someone add this to the documentation of lightGBM parameters at https://lightgbm.readthedocs.io/en/latest/Parameters.html, please?

Thank you!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants