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)
Metadata
Release files for gbm-autosplit 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gbm_autosplit-0.0.13.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gbm_autosplit-0.0.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / gbm_autosplit-0.0.13.tar.gz
| Download URL | gbm_autosplit-0.0.13.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43316235a56ab1ea7dba4232dba4238df253403ef47f19db75744eb6741ed029
|
|
BLAKE2b-256 checksum How to use checksums |
85b800b323775e3d8a686c2268765041af936dc2e30371c2edeffb5e8f1a38e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / gbm_autosplit-0.0.13-py3-none-any.whl
| Download URL | gbm_autosplit-0.0.13-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6022081876962ef9dde490549a473fd4295b7847d3fe20397a9b4f7bd9617e76
|
|
BLAKE2b-256 checksum How to use checksums |
9f544cdd5d4b74a7310ea820f0cd11c0412ed63aa313a405727f8d844b12eae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|