Skip to main content

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.

  1. User instanciates Classifier / Regressor with additional hyper parameters max_n_estimators, ratio_training, and eval_metric.
  2. User calls fit with x and y as usual
    1. Randomly split sample (x, y) into training and validation as ratio of sample size of training = ratio_training,
    2. Call fit of original GBM, using early stopping with split training and validation for the metric eval_metric with n_estimators = max_n_estimators
    3. Get best_n_estimators as the number of trees of stopped model of step 2-2.
    4. Call fit of original GBM with entire (x, y) and n_estimators = best_n_estimators of step 2-3.

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)

Source distribution for gbm-autosplit 0.0.13
File Size Uploaded
gbm_autosplit-0.0.13.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gbm-autosplit 0.0.13
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page