skillfed

forestci

Confidence intervals for scikit-learn forest algorithms

forestci v0.8 128.5K downloads/30d#11,704 on PyPI288
Permissive license MIT Active released

What it is and what it does

forestci extends scikit-learn's random forest objects by adding uncertainty quantification—computing in-bag error estimates and confidence intervals around predictions. It wraps fitted forest models and calculates how much prediction variability stems from the training set composition, helping you understand how reliable individual predictions are.

The package is built on algorithms from Stefan Wager's R implementation and works with scikit-learn 1.0 through 1.9. It requires a large number of trees for reliable intervals; an optional calibration routine attempts to extrapolate results for infinite trees but can be unstable, so the description recommends disabling it with calibrate=False and increasing tree count if numerical errors occur.

Use it for:

  • Quantify prediction uncertainty in random forest regression to report confidence bands alongside point estimates.
  • Assess classification model confidence by computing error bars for predicted probabilities.
  • Diagnose training set sensitivity by examining how much predictions vary with different subsamples.
  • Validate model stability before deployment by checking whether confidence intervals narrow as tree count increases.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Computes confidence intervals and variance estimates for scikit-learn random forest regression and classification models, quantifying prediction uncertainty.

Yes. Active maintenance, permissive MIT license, low install friction, no known vulnerabilities, and a focused role in an underserved niche (uncertainty quantification for scikit-learn forests). Install if you need confidence intervals on random forest predictions; skip if you use other ensemble libraries or don't require uncertainty estimates.

Install

forestci on PyPI

pip

pip install forestci

uv

uv add forestci

poetry

poetry add forestci

Installing forestci

Before you install

Low friction: pure Python wheel with three standard scientific dependencies (numpy, scikit-learn, scipy). Actively maintained with last commit 2026-07-29.

License in practice

MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal obligations.

Quickstart

pip install forestci

import forestci as fci
ci = fci.random_forest_error(
  forest=model,
  X_train_shape=X_train.shape,
  X_test=X,
  calibrate=True
)

Requires scikit-learn 1.0 through 1.9 and Python 3.10 or later; best results with a large number of trees in the forest model.

Verify before relying

  • Whether calibration routine convergence issues occur frequently in practice or only under specific model configurations.
  • Performance characteristics when applied to very large forests or high-dimensional datasets.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, scikit-learn, scipy
Maintenance actively maintained — 20 days since the last release
Last repo commit
First released
Downloads 128,512/month — #11,704 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: forestci-0.8-py3-none-any.whl

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Scientific/Engineering

Tags

random forest confidence intervalsforest prediction uncertaintyscikit-learn variance estimationensemble model error barsrandom forest prediction intervals
uncertainty-quantificationscikit-learn-extension

More Scientific/Engineering packages