hgboost - Hyperoptimized Gradient Boosting
hgboost is short for Hyperoptimized Gradient Boosting and is a python package for hyperparameter optimization for xgboost, catboost and lightboost using cross-validation, and evaluating the results on an independent validation set.
hgboost can be applied for classification and regression tasks.
hgboost is fun because:
* 1. Hyperoptimization of the Parameter-space using bayesian approach.
* 2. Determines the best scoring model(s) using k-fold cross validation.
* 3. Evaluates best model on independent evaluation set.
* 4. Fit model on entire input-data using the best model.
* 5. Works for classification and regression
* 6. Creating a super-hyperoptimized model by an ensemble of all individual optimized models.
* 7. Return model, space and test/evaluation results.
* 8. Makes insightful plots.
⭐️ Star this repo if you like it ⭐️
Blogs
Medium Blog 1: The Best Boosting Model using Bayesian Hyperparameter Tuning but without Overfitting.
Medium Blog 2: Create Explainable Gradient Boosting Classification models using Bayesian Hyperparameter Optimization.
Documentation pages
On the documentation pages you can find detailed information about the working of the hgboost with many examples.
Colab Notebooks
Schematic overview of hgboost
Installation Environment
conda create -n env_hgboost python=3.8
conda activate env_hgboost
Install from pypi
pip install hgboost
pip install -U hgboost # Force update
Import hgboost package
import hgboost as hgboost
Examples
Classification example for xgboost, catboost and lightboost:
# Load library
from hgboost import hgboost
# Initialization
hgb = hgboost(max_eval=10, threshold=0.5, cv=5, test_size=0.2, val_size=0.2, top_cv_evals=10, random_state=42)
# Fit xgboost by hyperoptimization and cross-validation
results = hgb.xgboost(X, y, pos_label='survived')
# [hgboost] >Start hgboost classification..
# [hgboost] >Collecting xgb_clf parameters.
# [hgboost] >Number of variables in search space is [11], loss function: [auc].
# [hgboost] >method: xgb_clf
# [hgboost] >eval_metric: auc
# [hgboost] >greater_is_better: True
# [hgboost] >pos_label: True
# [hgboost] >Total dataset: (891, 204)
# [hgboost] >Hyperparameter optimization..
# 100% |----| 500/500 [04:39<05:21, 1.33s/trial, best loss: -0.8800619834710744]
# [hgboost] >Best performing [xgb_clf] model: auc=0.881198
# [hgboost] >5-fold cross validation for the top 10 scoring models, Total nr. tests: 50
# 100%|██████████| 10/10 [00:42<00:00, 4.27s/it]
# [hgboost] >Evalute best [xgb_clf] model on independent validation dataset (179 samples, 20.00%).
# [hgboost] >[auc] on independent validation dataset: -0.832
# [hgboost] >Retrain [xgb_clf] on the entire dataset with the optimal parameters settings.
# Plot the ensemble classification validation results
hgb.plot_validation()
References
* http://hyperopt.github.io/hyperopt/
* https://github.com/dmlc/xgboost
* https://github.com/microsoft/LightGBM
* https://github.com/catboost/catboost
Maintainers
- Erdogan Taskesen, github: erdogant
Contribute
- Contributions are welcome.
Licence See LICENSE for details.
Coffee
- If you wish to buy me a Coffee for this work, it is very appreciated :)
Metadata
Release files for hgboost 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hgboost-2.0.1.tar.gz | 33.7 kB | Without provenance | Details for hgboost-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hgboost-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for hgboost-2.0.1-py3-none-any.whl |
Total release size: 66.2 kB
Release files / hgboost-2.0.1.tar.gz
| Download URL | hgboost-2.0.1.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51fb44ea5eb57662c917a8aa7dc92c38c282ac534fdfab49531e001fa6e1e09c
|
|
BLAKE2b-256 checksum How to use checksums |
447d9fae2f738c16e8cae8732bd73dcb19e5f23668783387772c303adcab84ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / hgboost-2.0.1-py3-none-any.whl
| Download URL | hgboost-2.0.1-py3-none-any.whl |
|---|---|
| Size | 32.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72abb082a89b6217ad29eefb1c62350783903b7b8c6c990897cd9e50fa880d4c
|
|
BLAKE2b-256 checksum How to use checksums |
cc88b78c2b15e7a51de851f7ddddc06b1d1fa3169edde8cb07c3423ef770dfea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for hgboost 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.