Practical overview
When it fits
Use NGBoost when a prediction task calls for a predictive distribution rather than only a point estimate, or when comparing modular choices in a probabilistic boosting model.
Who it is for
- Python practitioners developing probabilistic regression models.
- Researchers comparing scoring rules or modeling choices for probabilistic predictions.
- Machine-learning developers exploring custom distributions or scoring rules.
Documented uses
- Build regression models that produce predictive distributions.
- Compare or tune scoring rules for probabilistic predictions.
- Develop probabilistic models using custom distributions or scoring rules.
Requirements & limits
- It is a Python library, not a hosted prediction service.
- Its modular design exposes choices of scoring rule, probability distribution and base learner.
- The listed platforms are Linux, macOS and Windows.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Fit a probabilistic regression model and evaluate predictions
Train an NGBoost regressor on California housing data, produce predictions and predictive distributions, and calculate test MSE and negative log likelihood.
Before you start
- NGBoost and Scikit-learn installed using pip or conda-forge.
- California housing data available through Scikit-learn's dataset loader.
Steps
Install NGBoost with the command below or
conda install -c conda-forge ngboost.pip install --upgrade ngboostLoad
fetch_california_housing()and split its data and targets withtrain_test_split(X, Y, test_size=0.2).Fit
NGBRegressor()on the training data, then callpredict(X_test)andpred_dist(X_test).Calculate test MSE with
mean_squared_error(Y_preds, Y_test)and test NLL with-Y_dists.logpdf(Y_test).mean().
Expected outcome
A fitted probabilistic regressor provides point predictions and predictive distributions, with test MSE and NLL calculations.
Guide limitations
- The example uses California housing data, not Boston housing, despite the README's introductory label.
- No train/test random seed or expected metric values are specified.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 11 October 2026
- Original website title
- GitHub - stanfordmlgroup/ngboost: Natural Gradient Boosting for Probabilistic Prediction · GitHub · Official homepage title · retained in its source language

