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

[python-package] How can I use goss in the latest version 4.5 #6603

Closed
luxiangyuricardo opened this issue Aug 13, 2024 · 4 comments
Closed

Comments

@luxiangyuricardo
Copy link

In the latest version the parameter "boosting_type" doesn't include "goss" anymore. How can I activate it in the LGBMRegressor

@jameslamb jameslamb changed the title How can I use goss in the latest version 4.5 [python-package] How can I use goss in the latest version 4.5 Aug 13, 2024
@jameslamb
Copy link
Collaborator

Thanks for using LightGBM.

As described at https://lightgbm.readthedocs.io/en/latest/Parameters.html#data_sample_strategy, GOSS can be specified via data_sample_strategy. That change was made in LightGBM #4827, as part of v4.0.0 (https://github.com/microsoft/LightGBM/releases/tag/v4.0.0).

Here's a minimal, reproducible example:

import lightgbm as lgb
from sklearn.datasets import make_regression

X, y = make_regression(n_samples=10_000, n_features=10)
reg = lgb.LGBMRegressor(
  n_estimators=10,
  data_sample_strategy="goss"
)
reg.fit(X, y)

If you do that, you'll see this in the logs:

[LightGBM] [Info] Using GOSS

@luxiangyuricardo
Copy link
Author

luxiangyuricardo commented Aug 13, 2024

got it! Thanks a lot.Now I have a new question:
In the doc LightGBM regressor includes following params:

__init__(boosting_type='gbdt', num_leaves=31, max_depth=-1, learning_rate=0.1, n_estimators=100, subsample_for_bin=200000, objective=None, class_weight=None, min_split_gain=0.0, min_child_weight=0.001, min_child_samples=20, subsample=1.0, subsample_freq=0, colsample_bytree=1.0, reg_alpha=0.0, reg_lambda=0.0, random_state=None, n_jobs=None, importance_type='split', **kwargs)

But no data_sample_strategy inside.

Why can it be directly changed?

@jameslamb
Copy link
Collaborator

But no 'data_sample_strategy' inside.Why can it be directly changed?

Any other parameters passed to the constructor of LGBMRegressor which don't match its keyword arguments will be collected together and sent to LightGBM's C++ library as additional parameters.

As it says at https://lightgbm.readthedocs.io/en/latest/pythonapi/lightgbm.LGBMRegressor.html:

**kwargs

Other parameters for the model. Check http://lightgbm.readthedocs.io/en/latest/Parameters.html for more parameters.

@jameslamb
Copy link
Collaborator

By the way, I reformatted your follow-up question. If you're unsure how I did that, please see https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.

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