Skip to content

ngboost-lightning logo ngboost-lightning

Natural gradient boosting for probabilistic prediction, powered by LightGBM.

ngboost-lightning reimplements the NGBoost algorithm using LightGBM's histogram-based tree building instead of scikit-learn's exact splitter. The algorithm is structurally identical — K independent boosters (one per distribution parameter), natural gradients, line search — but training is up to 13x faster on larger datasets.

Key Features

  • Full predictive distributions — predict means, variances, quantiles, and CDFs, not just point estimates
  • 12 distributions — Normal, LogNormal, Exponential, Gamma, Poisson, Laplace, StudentT, Weibull, HalfNormal, Cauchy, Bernoulli, Categorical
  • Survival analysis — right-censored data with censored log-likelihood
  • Two scoring rules — LogScore (MLE) and CRPS for calibration-focused training
  • sklearn compatible — pipelines, cross-validation, get_params/set_params
  • LightGBM speed — histogram-based splitting, 5-13x faster than NGBoost on 10k+ samples

Quick Example

from ngboost_lightning import LightningBoostRegressor

reg = LightningBoostRegressor(n_estimators=200, learning_rate=0.05)
reg.fit(X_train, y_train)

# Full predictive distribution
dist = reg.pred_dist(X_test)
dist.mean()       # conditional mean
dist.ppf(0.05)    # 5th percentile
dist.ppf(0.95)    # 95th percentile

Next Steps