Install & Compatibility
Where this runs
tested against v0.5.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 23.8s · import 9.458s · 497MB
529MB installed
● package 529MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
NGBRegressor
✓ from ngboost import NGBRegressor
NGBClassifier
✓ from ngboost import NGBClassifier
✗ from ngboost.ngboost import NGBClassifier
Common error: trying to import from submodule instead of top-level
Normal
✓ from ngboost.distns import Normal
✗ from ngboost import Normal
Distributions are in ngboost.distns, not top-level.
LogScore
✓ from ngboost.scores import LogScore
✗ from ngboost import LogScore
Scores are in ngboost.scores submodule.
Basic usage of NGBoost for regression with a Normal distribution and LogScore.
import numpy as np
from ngboost import NGBRegressor
from ngboost.distns import Normal
from ngboost.scores import LogScore
# Generate sample data
np.random.seed(42)
X = np.random.randn(100, 1)
y = X[:, 0] + 0.1*np.random.randn(100)
# Train probabilistic model
ngb = NGBRegressor(Dist=Normal, Score=LogScore, n_estimators=100, learning_rate=0.01, verbose=False)
ngb.fit(X, y)
# Predict: mean and variance (or scale) of Normal distribution
y_preds = ngb.predict(X)
# Use ngb.pred_dist(X) to get distribution object
Errors
Common errors & fixes
ImportError: cannot import name 'NGBRegressor' from 'ngboost'
Incorrect installation or trying to import from a different environment.
fixRun `pip install ngboost` and ensure you are in the correct Python environment. Then use `from ngboost import NGBRegressor`.
ModuleNotFoundError: No module named 'sklearn.metrics._pairwise_distances'
Incompatible scikit-learn version (likely <0.22) with newer ngboost.
fixUpgrade scikit-learn: `pip install --upgrade scikit-learn`
AttributeError: 'NGBRegressor' object has no attribute 'pred_dist'
Using an older version of ngboost where the method is called `predict_dist` instead of `pred_dist`.
fixUse `ngb.pred_dist(X)` for ngboost>=0.5.0; for older versions use `ngb.predict_dist(X)`.
ValueError: When `natural_gradient` is True, `Score` must be an instance of `LogScore` or a class that implements `natural_gradient`.
Attempting to use natural_gradient with a custom Score that doesn't support it.
fixEither set `natural_gradient=False` or use a built-in Score like LogScore.
Upgrade
Version history
0.5.10latest on PyPI · released Mar 24, 2026
Audit
Dependencies
scikit-learnrequiredCore dependency for all models; version compatibility critical.
numpyrequiredCore dependency for arrays and numeric operations.
scipyrequiredUsed for distributions and optimization.
pandasoptionalOptional for example usage; not required for core.