Skip to main content

actions wheels rtd pypi pyversions

skgrf provides scikit-learn compatible Python bindings to the C++ random forest implementation, grf, using Cython.

The latest release of skgrf uses version 2.0.0 of grf.

skgrf is still in development. Please create issues for any discrepancies or errors. PRs welcome.

Documentation

Installation

skgrf is available on pypi and can be installed via pip:

pip install skgrf

Estimators

  • GRFForestCausalRegressor

  • GRFForestInstrumentalRegressor

  • GRFForestLocalLinearRegressor

  • GRFForestQuantileRegressor

  • GRFForestRegressor

  • GRFBoostedForestRegressor

  • GRFForestSurvival

Usage

GRFForestRegressor

The GRFForestRegressor predictor uses grf’s RegressionPredictionStrategy class.

from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from skgrf.ensemble import GRFForestRegressor

X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y)

forest = GRFForestRegressor()
forest.fit(X_train, y_train)

predictions = forest.predict(X_test)
print(predictions)
# [31.81349144 32.2734354  16.51560285 11.90284392 39.69744341 21.30367911
#  19.52732937 15.82126562 26.49528961 11.27220097 16.02447197 20.01224404
#  ...
#  20.70674263 17.09041289 12.89671205 20.79787926 21.18317924 25.45553279
#  20.82455595]

GRFForestQuantileRegressor

The GRFForestQuantileRegressor predictor uses grf’s QuantilePredictionStrategy class.

from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from skgrf.ensemble import GRFForestQuantileRegressor

X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y)

forest = GRFForestQuantileRegressor(quantiles=[0.1, 0.9])
forest.fit(X_train, y_train)

predictions = forest.predict(X_test)
print(predictions)
# [[21.9 50. ]
# [ 8.5 24.5]
# ...
# [ 8.4 18.6]
# [ 8.1 20. ]]

License

skgrf is licensed under GPLv3.

Development

To develop locally, it is recommended to have asdf, make and a C++ compiler already installed. After cloning, run make setup. This will setup the grf submodule, install python and poetry from .tool-versions, install dependencies using poetry, copy the grf source code into skgrf, and then build and install skgrf in the local virtualenv.

To format code, run make fmt. This will run isort and black against the .py files.

To run tests and inspect coverage, run make test or make xtest for testing in parallel.

To rebuild in place after making changes, run make build.

To create python package artifacts, run make dist.

To build and view documentation, run make docs.

Release files for skgrf 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for skgrf 0.2.0
File Size Uploaded
skgrf-0.2.0.tar.gz 1.8 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for skgrf 0.2.0
File
skgrf-0.2.0-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
skgrf-0.2.0-cp39-cp39-manylinux1_i686.manylinux_2_5_i686.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-32 Details
skgrf-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details
skgrf-0.2.0-cp38-cp38-manylinux1_x86_64.manylinux_2_5_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
skgrf-0.2.0-cp38-cp38-manylinux1_i686.manylinux_2_5_i686.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-32 Details
skgrf-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details
skgrf-0.2.0-cp37-cp37m-manylinux1_x86_64.manylinux_2_5_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
skgrf-0.2.0-cp37-cp37m-manylinux1_i686.manylinux_2_5_i686.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32 Details
skgrf-0.2.0-cp37-cp37m-macosx_10_15_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64 Details
skgrf-0.2.0-cp36-cp36m-manylinux1_x86_64.manylinux_2_5_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
skgrf-0.2.0-cp36-cp36m-manylinux1_i686.manylinux_2_5_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
skgrf-0.2.0-cp36-cp36m-macosx_10_15_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64 Details

Total release size: 33.8 MB

Release files / skgrf-0.2.0.tar.gz

Download URL skgrf-0.2.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
aa412f976babeef9be8264e631fd6e0d7b26bde5e25e3a2075ff4828640502e5
BLAKE2b-256 checksum
How to use checksums
6ea8ff430d08af9fb1f041962d4d4437a91ceab3d8b3c3643433fd44ca4cc3ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.5 Darwin/20.1.0

Release files / skgrf-0.2.0-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Download URL skgrf-0.2.0-cp39-cp39-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Size 2.7 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
5544dd342c337c7d0d73c918884149189c9f44467e3233741a5ace2b3576af22
BLAKE2b-256 checksum
How to use checksums
841a0e45085e7825cb6ece851ac0491346223efeed8e2987ccb3772440685e15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp39-cp39-manylinux1_i686.manylinux_2_5_i686.whl

Download URL skgrf-0.2.0-cp39-cp39-manylinux1_i686.manylinux_2_5_i686.whl
Size 2.6 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
5fa7cc753d3320b6014979af05ebbb02013943aaa45d37dc548e92fb2293caed
BLAKE2b-256 checksum
How to use checksums
12b7b2bd96769fea8fa7244f286364885f5f4fd13bd2cdf1e38f8a80b27bd79a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl

Download URL skgrf-0.2.0-cp39-cp39-macosx_10_15_x86_64.whl
Size 2.7 MB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
5398387670edd132f538ec2c2393677a1bc876c45ca5cb3f7fe7ca0dc233d028
BLAKE2b-256 checksum
How to use checksums
db91a8a4550d2bb34ffadd8bbc9144974012af7fd782751414b3139c95e3cb18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.4

Release files / skgrf-0.2.0-cp38-cp38-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Download URL skgrf-0.2.0-cp38-cp38-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8a244d5ad8d89e71a73075c0043029a9025807d372f21711208e39bb349d8c32
BLAKE2b-256 checksum
How to use checksums
489a4faaee4165a8ba043f6d23f4114a1de6cf354ded703106ed30ee75313033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp38-cp38-manylinux1_i686.manylinux_2_5_i686.whl

Download URL skgrf-0.2.0-cp38-cp38-manylinux1_i686.manylinux_2_5_i686.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
b16987236e1d917f19486611be6d93fc5d162503c15911a97fe368082faa283c
BLAKE2b-256 checksum
How to use checksums
0e24fc0edb8edb8fbdeae29be11bc019525fd9398a43b6192c91471683c94fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl

Download URL skgrf-0.2.0-cp38-cp38-macosx_10_15_x86_64.whl
Size 2.7 MB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
c3cc18c1377c0ec8ac5694666344c0bfa7f3adf0c2e940b71ff1f8749c889b4c
BLAKE2b-256 checksum
How to use checksums
e625bd8f210c0d0483ae63376efa359313a456b12107a883d6492bd557c674d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.9

Release files / skgrf-0.2.0-cp37-cp37m-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Download URL skgrf-0.2.0-cp37-cp37m-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Size 2.7 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
c8756343077d96ed78847c0f25ce695251186a615a023352f55896e6519eff6e
BLAKE2b-256 checksum
How to use checksums
5e812afe59c68c6a0522a1b049478047fc2c9f1dd9bb64e34537dad0051654cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp37-cp37m-manylinux1_i686.manylinux_2_5_i686.whl

Download URL skgrf-0.2.0-cp37-cp37m-manylinux1_i686.manylinux_2_5_i686.whl
Size 2.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
c9e3a4fc114c884355e5d9be20af2676ce1560a745d2e0fa426dc51b024a792d
BLAKE2b-256 checksum
How to use checksums
fbf0e7d08250724251864137ca4ffb3d6919d955fcbfb1b774aa29e8af2401f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp37-cp37m-macosx_10_15_x86_64.whl

Download URL skgrf-0.2.0-cp37-cp37m-macosx_10_15_x86_64.whl
Size 2.7 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
a31eae1af14944bc4a464cb87b340b2d2fbf7a55cb53a376beb0439107b2abf6
BLAKE2b-256 checksum
How to use checksums
d7f1f27700bbe73d9389956fc23b9be884bd636269fc9b0439aad607d263ab6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9

Release files / skgrf-0.2.0-cp36-cp36m-manylinux1_x86_64.manylinux_2_5_x86_64.whl

Download URL skgrf-0.2.0-cp36-cp36m-manylinux1_x86_64.manylinux_2_5_x86_64.whl
Size 2.7 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
c685e226304fcb89d3d8db50e58d674ec8fbbbb59a2d2a3840eee2bb5437f066
BLAKE2b-256 checksum
How to use checksums
3c05763807d8a885f4c2de4848bd8f1da4e2b8d718a5bdbb818cd52654c50ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp36-cp36m-manylinux1_i686.manylinux_2_5_i686.whl

Download URL skgrf-0.2.0-cp36-cp36m-manylinux1_i686.manylinux_2_5_i686.whl
Size 2.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
10464e0bc5248b1678f1c8a9dd189e5d68d2eff4dbc02e9b16134fe5e3886a74
BLAKE2b-256 checksum
How to use checksums
f1fa4c769ba22fba28ca729a4664913b9f7b4c6a3c00d2b963da2680a2f28b1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Release files / skgrf-0.2.0-cp36-cp36m-macosx_10_15_x86_64.whl

Download URL skgrf-0.2.0-cp36-cp36m-macosx_10_15_x86_64.whl
Size 2.7 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
e089d89e3b606d310443f6e9ab6335ca6ade435bc5467bb15c8d078bed1e3a3d
BLAKE2b-256 checksum
How to use checksums
59da3770102ffc18e565888f9dce31a0feba5f79be60514673e1ae476be86651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

13 release files

0.1.1

13 release files

0.1.0

13 release files

0.0.1

13 release files

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page