Skip to main content

scikit-learn compatible quantile forests.

Project description

quantile-forest

PyPI - Version License GitHub Actions Codecov Code Style black DOI

quantile-forest offers a Python implementation of quantile regression forests compatible with scikit-learn.

Quantile regression forests (QRF) are a non-parametric, tree-based ensemble method for estimating conditional quantiles, with application to high-dimensional data and uncertainty estimation [1]. The estimators in this package are performant, Cython-optimized QRF implementations that extend the forest estimators available in scikit-learn to estimate conditional quantiles. The estimators can estimate arbitrary quantiles at prediction time without retraining and provide methods for out-of-bag estimation, calculating quantile ranks, and computing proximity counts. They are compatible with and can serve as drop-in replacements for the scikit-learn variants.

Example of fitted model predictions and prediction intervals on California housing data (code)

Quick Start

Install quantile-forest from PyPI using pip:

pip install quantile-forest

Usage

from quantile_forest import RandomForestQuantileRegressor
from sklearn import datasets
X, y = datasets.fetch_california_housing(return_X_y=True)
qrf = RandomForestQuantileRegressor()
qrf.fit(X, y)
y_pred = qrf.predict(X, quantiles=[0.025, 0.5, 0.975])

Documentation

An installation guide, API documentation, and examples can be found in the documentation.

References

[1] N. Meinshausen, "Quantile Regression Forests", Journal of Machine Learning Research, 7(Jun), 983-999, 2006. http://www.jmlr.org/papers/volume7/meinshausen06a/meinshausen06a.pdf

Citation

If you use this package in academic work, please consider citing https://joss.theoj.org/papers/10.21105/joss.05976:

@article{Johnson2024,
    doi = {10.21105/joss.05976},
    url = {https://doi.org/10.21105/joss.05976},
    year = {2024},
    publisher = {The Open Journal},
    volume = {9},
    number = {93},
    pages = {5976},
    author = {Reid A. Johnson},
    title = {quantile-forest: A Python Package for Quantile Regression Forests},
    journal = {Journal of Open Source Software}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantile_forest-1.3.5.tar.gz (81.6 kB view hashes)

Uploaded Source

Built Distributions

quantile_forest-1.3.5-cp312-cp312-win_amd64.whl (183.6 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

quantile_forest-1.3.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

quantile_forest-1.3.5-cp312-cp312-macosx_11_0_arm64.whl (199.1 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

quantile_forest-1.3.5-cp312-cp312-macosx_10_9_x86_64.whl (216.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

quantile_forest-1.3.5-cp312-cp312-macosx_10_9_universal2.whl (365.5 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

quantile_forest-1.3.5-cp311-cp311-win_amd64.whl (184.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

quantile_forest-1.3.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

quantile_forest-1.3.5-cp311-cp311-macosx_11_0_arm64.whl (198.1 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

quantile_forest-1.3.5-cp311-cp311-macosx_10_9_x86_64.whl (216.7 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

quantile_forest-1.3.5-cp311-cp311-macosx_10_9_universal2.whl (365.2 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

quantile_forest-1.3.5-cp310-cp310-win_amd64.whl (183.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

quantile_forest-1.3.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

quantile_forest-1.3.5-cp310-cp310-macosx_11_0_arm64.whl (198.1 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

quantile_forest-1.3.5-cp310-cp310-macosx_10_9_x86_64.whl (216.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

quantile_forest-1.3.5-cp310-cp310-macosx_10_9_universal2.whl (365.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

quantile_forest-1.3.5-cp39-cp39-win_amd64.whl (184.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

quantile_forest-1.3.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

quantile_forest-1.3.5-cp39-cp39-macosx_11_0_arm64.whl (198.4 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

quantile_forest-1.3.5-cp39-cp39-macosx_10_9_x86_64.whl (216.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

quantile_forest-1.3.5-cp39-cp39-macosx_10_9_universal2.whl (365.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

quantile_forest-1.3.5-cp38-cp38-win_amd64.whl (183.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

quantile_forest-1.3.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

quantile_forest-1.3.5-cp38-cp38-macosx_11_0_arm64.whl (197.5 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

quantile_forest-1.3.5-cp38-cp38-macosx_10_9_x86_64.whl (216.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

quantile_forest-1.3.5-cp38-cp38-macosx_10_9_universal2.whl (364.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page