Skip to main content

Implements several boosting algorithms in Python

Project description

KTBoost - A Python Package for Boosting

This Python package implements several boosting algorithms with different combinations of base learners, optimization algorithms, and loss functions.

Description

Concerning base learners, KTboost includes:

  • Trees
  • Kernel Ridge regression
  • A combination of the two (i.e., the KTBoost algorithm)

Concerning the optimization step for finding the boosting updates, the package supports:

  • Gradient descent
  • Newton-Rahson method
  • A hybrid version of the two for trees as base learners

The package implements the following loss functions:

  • Continuous data ("regression"): quadratic loss (L2 loss), absolute error (L1 loss), Huber loss, quantile regression loss, Gamma regression loss, negative Gaussian likelihood with both the mean and the standard deviation as functions of features
  • Count data ("regression"): Poisson regression loss
  • (Unorderd) Categorical data ("classification"): logistic regression loss (log loss), exponential loss, cross entropy loss with softmax
  • Mixed continuous-categorical data ("censored regression"): negative Tobit likelihood (i.e., the Grabit model)

Installation

It can be installed using

pip install KTBoost

and then loaded using

import KTBoost.KTBoost as KTBoost

Usage and examples

The package re-uses code from scikit-learn and its workflow is very similar to that of scikit-learn.

The two main classes are KTBoost.BoostingClassifier and KTBoost.BoostingRegressor.

The following code example defines models, trains them, and makes predictions.

import KTBoost.KTBoost as KTBoost

######################################
## Define models (several examples) ##
######################################
## Standard tree boosting for regression with quadratic loss and hybrid gradient-Newton updates as in Friedman (2001)
model = KTBoost.BoostingRegressor(loss='ls')
## Grabit model as in Sigrist and Hirnschall (2018)
model = KTBoost.BoostingRegressor(loss='tobit')
## KTBoost algorithm for classification with Newton updates
model = KTBoost.BoostingClassifier(loss='deviance',base_learner='combined',update_step='newton')
## Gradient boosting for classification with trees as base learners
model = KTBoost.BoostingClassifier(loss='deviance',update_step='gradient')
## Newton boosting for classification model with trees as base learners
model = KTBoost.BoostingClassifier(loss='deviance',update_step='newton')
## Hybrid gradient-Newton boosting (Friedman, 2001) for classification with trees as base learners
model = KTBoost.BoostingClassifier(loss='deviance',update_step='hybrid')
## Kernel boosting for regression with quadratic loss
model = KTBoost.BoostingRegressor(loss='ls',base_learner='kernel')


##################
## Train models ##
##################
model.fit(Xtrain,ytrain)

######################
## Make predictions ##
######################
model.predict(Xpred)

References

  • Friedman, J., Hastie, T., & Tibshirani, R. (2000). Additive logistic regression: a statistical view of boosting. The annals of statistics, 28(2), 337-407.
  • Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine. Annals of statistics, 1189-1232.
  • Sigrist, F. (2018). Gradient and Newton Boosting for Classification and Regression. arXiv preprint arXiv:1808.03064.
  • Sigrist, F., & Hirnschall, C. (2017). Grabit: Gradient Tree Boosted Tobit Models for Default Prediction. arXiv preprint arXiv:1711.08695.

Project details


Download files

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

Source Distribution

KTBoost-0.0.8.tar.gz (46.9 kB view details)

Uploaded Source

Built Distribution

KTBoost-0.0.8-py2-none-any.whl (51.3 kB view details)

Uploaded Python 2

File details

Details for the file KTBoost-0.0.8.tar.gz.

File metadata

  • Download URL: KTBoost-0.0.8.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for KTBoost-0.0.8.tar.gz
Algorithm Hash digest
SHA256 56964d5e05e69155d1ebb21e13c11cc4db3902d0851af26ba5bf4c08194d5bc2
MD5 99042bcb219b03e2e343eea5625f85bc
BLAKE2b-256 97592b6ca61ec89b155194d2feabeb0344c4214de862273657a6c02d1a959675

See more details on using hashes here.

File details

Details for the file KTBoost-0.0.8-py2-none-any.whl.

File metadata

  • Download URL: KTBoost-0.0.8-py2-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for KTBoost-0.0.8-py2-none-any.whl
Algorithm Hash digest
SHA256 ec0ee3b6bba970331179675348a9e54f4347247454a03535930ea0b56129da53
MD5 c9eed67412a890fea2c0368624fa7c40
BLAKE2b-256 c3ccfab97d77a50bcdf9c1979ada93a7da6de5b046ef2289b04a24bb45a2a98e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page