gbm_autosplit
LightGBM / XGBoost scikit learn interfaces which performs "early stopping" with single data set during fit.
Motivation
"Early stopping" is great practice to tune the number of estimators for gradient boosting models. However it is not easy to use it in tuning module in scikit-learn such as RandomizedSearchCV / GridSearchCV because to use early stopping module requires two data sets but scikit learn does not have such interface.
Algorithm
To solve this situation, this interface performs following steps with in fit.
- User instanciates Classifier / Regressor with additional hyper parameters
max_n_estimators,ratio_training, andeval_metric. - User calls
fitwithxandyas usual- Randomly split sample
(x, y)into training and validation as ratio of sample size of training =ratio_training, - Call
fitof original GBM, using early stopping with split training and validation for the metriceval_metricwithn_estimators=max_n_estimators - Get
best_n_estimatorsas the number of trees of stopped model of step 2-2. - Call
fitof original GBM with entire(x, y)andn_estimators=best_n_estimatorsof step 2-3.
- Randomly split sample
Install
pip install gbm_autosplit
Requires Python 3.10+. Tip-of-tree XGBoost 3.3+ requires Python 3.12+.
Usage
import gbm_autosplit
estimator = gbm_autosplit.LGBMClassifier()
estimator.fit(x, y)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gbm_autosplit-0.0.13.tar.gz.
File metadata
- Download URL: gbm_autosplit-0.0.13.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43316235a56ab1ea7dba4232dba4238df253403ef47f19db75744eb6741ed029
|
|
| MD5 |
70952becf5ae9d8174b5667408ebc49c
|
|
| BLAKE2b-256 |
85b800b323775e3d8a686c2268765041af936dc2e30371c2edeffb5e8f1a38e6
|
File details
Details for the file gbm_autosplit-0.0.13-py3-none-any.whl.
File metadata
- Download URL: gbm_autosplit-0.0.13-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6022081876962ef9dde490549a473fd4295b7847d3fe20397a9b4f7bd9617e76
|
|
| MD5 |
52d70086ae3f4fc042f51fcf03e70d42
|
|
| BLAKE2b-256 |
9f544cdd5d4b74a7310ea820f0cd11c0412ed63aa313a405727f8d844b12eae0
|