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.1

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

Built distribution (wheel)

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

Total release size: 103.8 kB

Release files / ngboost-0.6.1.tar.gz

Download URL ngboost-0.6.1.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3f90825657dc49dbd88fea5ffa5ef6109686d5fa48360144546c1e5926ade12e
BLAKE2b-256 checksum
How to use checksums
00bb107d6f740660f2bb2d1f419b0f1da01792c9cb93951d2c9ee04e3d870ac0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.11 Darwin/27.3.0

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

Download URL ngboost-0.6.1-py3-none-any.whl
Size 57.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3cd651652ccf422dd95f8a7543ba8ba7dc5996b5fe42a8fdb3a7d2a1584a12a
BLAKE2b-256 checksum
How to use checksums
3d3ccc83536d00cced7cd2987ea3fc5d3e96e17cc86b84cb17ce7c27ef9dc3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.11 Darwin/27.3.0

Security for ngboost 0.6.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.

Release history Release notifications | RSS feed

This release

0.6.1 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