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)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbm_autosplit-0.0.13.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbm_autosplit-0.0.13-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for gbm_autosplit-0.0.13.tar.gz
Algorithm Hash digest
SHA256 43316235a56ab1ea7dba4232dba4238df253403ef47f19db75744eb6741ed029
MD5 70952becf5ae9d8174b5667408ebc49c
BLAKE2b-256 85b800b323775e3d8a686c2268765041af936dc2e30371c2edeffb5e8f1a38e6

See more details on using hashes here.

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

Hashes for gbm_autosplit-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 6022081876962ef9dde490549a473fd4295b7847d3fe20397a9b4f7bd9617e76
MD5 52d70086ae3f4fc042f51fcf03e70d42
BLAKE2b-256 9f544cdd5d4b74a7310ea820f0cd11c0412ed63aa313a405727f8d844b12eae0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 files

0.0.12

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 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