Skip to main content

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

via pip

pip install --upgrade ngboost

via conda-forge

conda install -c conda-forge ngboost

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

Metadata

Release files for ngboost-release 0.3.12.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ngboost-release 0.3.12.post2
File Size Uploaded
ngboost-release-0.3.12.post2.tar.gz 25.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ngboost-release 0.3.12.post2
File Interpreter ABI Platform
ngboost_release-0.3.12.post2-py3-none-any.whl Python 3 none any Details

Total release size: 57.6 kB

Release files / ngboost-release-0.3.12.post2.tar.gz

Download URL ngboost-release-0.3.12.post2.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8b50c3c1fe4598cd909667be9960970092f3448545151a33c671fa00b1fe76a0
BLAKE2b-256 checksum
How to use checksums
fb5c81649866e0ed780965dd8e21e4de5dbcccc077606b52138b149d2411156b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.15 CPython/3.10.6 Linux/5.15.0-47-generic

Release files / ngboost_release-0.3.12.post2-py3-none-any.whl

Download URL ngboost_release-0.3.12.post2-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e05723e315f36eff6d68b2f3a574e8e7d66207958a6e6b669da6d76984b26404
BLAKE2b-256 checksum
How to use checksums
08e36de0f102e0003c184d26d44cce20c4d41b7288010b6961b539ea1eddacd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.15 CPython/3.10.6 Linux/5.15.0-47-generic

Release history Release notifications | RSS feed

This release

0.3.12.post2 This release

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