Skip to main content

Library for probabilistic predictions via gradient boosting.

Project description

NGBoost: Natural Gradient Boosting for Probabilistic Prediction

Python package Github License Code style: black

ngboost is a Python library that implements Natural Gradient Boosting, as described in "NGBoost: Natural Gradient Boosting for Probabilistic Prediction". It is built on top of Scikit-Learn, and is designed to be scalable and modular with respect to choice of proper scoring rule, distribution, and base learner. A didactic introduction to the methodology underlying NGBoost is available in this slide deck.

Installation

pip install --upgrade git+https://github.com/stanfordmlgroup/ngboost.git

Usage

Probabilistic regression example on the Boston housing dataset:

from ngboost import NGBRegressor

from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error

X, Y = load_boston(True)
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2)

ngb = NGBRegressor().fit(X_train, Y_train)
Y_preds = ngb.predict(X_test)
Y_dists = ngb.pred_dist(X_test)

# test Mean Squared Error
test_MSE = mean_squared_error(Y_preds, Y_test)
print('Test MSE', test_MSE)

# test Negative Log Likelihood
test_NLL = -Y_dists.logpdf(Y_test).mean()
print('Test NLL', test_NLL)

Details on available distributions, scoring rules, learners, tuning, and model interpretation are available in our user guide, which also includes numerous usage examples and information on how to add new distributions or scores to NGBoost.

License

Apache License 2.0.

Reference

Tony Duan, Anand Avati, Daisy Yi Ding, Khanh K. Thai, Sanjay Basu, Andrew Y. Ng, Alejandro Schuler. 2019. NGBoost: Natural Gradient Boosting for Probabilistic Prediction. arXiv

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

ngboost-0.3.1.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

ngboost-0.3.1-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file ngboost-0.3.1.tar.gz.

File metadata

  • Download URL: ngboost-0.3.1.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.10

File hashes

Hashes for ngboost-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c9fe9cd2e5cc19a706d5d0af4e8c8be3b289cecb6314181c08f056b3dc7df1e0
MD5 9bd375492a5f4ce806790832c3e2076f
BLAKE2b-256 079aad68dcb71e8fab43b71e7be3c8056eac059249383c273339b2f5f21ad2f5

See more details on using hashes here.

File details

Details for the file ngboost-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ngboost-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.10

File hashes

Hashes for ngboost-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb7a33f09b227ceb4964cad1fdbbcebb9a8074f1784cc7719f541c3ef1a9a9a6
MD5 feefcd66d7597f0b21d61bad678344dc
BLAKE2b-256 e4d0a3d8ab7a9b36339b2b1626152c3071ed73ee7b9823925a57df1486306aa0

See more details on using hashes here.

Supported by

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