Skip to main content

NGBoost: Natural Gradient Boosting for Probabilistic Prediction

Python package GitHub Repo Size Github License Code style: black PyPI PyPI Downloads

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 fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error

# Load California housing dataset
cal = fetch_california_housing()
X, Y = cal.data, cal.target

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 0.6.0

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 0.6.0
File Size Uploaded Provenance Actions
ngboost-0.6.0.tar.gz 44.5 kB Without provenance Details for ngboost-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ngboost 0.6.0
File Interpreter ABI Platform Actions
ngboost-0.6.0-py3-none-any.whl Python 3 none any Details for ngboost-0.6.0-py3-none-any.whl

Total release size: 99.8 kB

Release files / ngboost-0.6.0.tar.gz

Download URL ngboost-0.6.0.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e6776b9a958e05fa150201516fe7734b2f0387799eddfdcce0b8c99cc7420c78
BLAKE2b-256 checksum
How to use checksums
3b2780ffa8738c414c70e8451113618976b114668a968e3a8b6daca7d9d6af18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.16 Darwin/27.0.0

Release files / ngboost-0.6.0-py3-none-any.whl

Download URL ngboost-0.6.0-py3-none-any.whl
Size 55.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fb3c5c7a2f0ebb2fe6b3c0fa1c9613b8aa33adffce7823a1493ad01b08a3c49
BLAKE2b-256 checksum
How to use checksums
354a9923ab8e6103998900081fa70398ac30f2b27357d8e0d77439c3f3409ff3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.16 Darwin/27.0.0

Security for ngboost 0.6.0

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.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

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