{"id":18931964,"url":"https://github.com/crflynn/skgrf","last_synced_at":"2025-08-16T13:39:05.904Z","repository":{"id":38744091,"uuid":"314447477","full_name":"crflynn/skgrf","owner":"crflynn","description":"scikit-learn compatible Python bindings for grf (generalized random forests) C++ random forest library","archived":false,"fork":false,"pushed_at":"2022-05-07T00:10:30.000Z","size":423,"stargazers_count":33,"open_issues_count":13,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T07:06:26.796Z","etag":null,"topics":["generalized-random-forest","machine-learning","random-forest","scikit-learn"],"latest_commit_sha":null,"homepage":"https://skgrf.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crflynn.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-20T04:36:24.000Z","updated_at":"2025-05-26T16:58:37.000Z","dependencies_parsed_at":"2022-09-19T08:20:40.983Z","dependency_job_id":null,"html_url":"https://github.com/crflynn/skgrf","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/crflynn/skgrf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Fskgrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Fskgrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Fskgrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Fskgrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crflynn","download_url":"https://codeload.github.com/crflynn/skgrf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Fskgrf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265508361,"owners_count":23779132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generalized-random-forest","machine-learning","random-forest","scikit-learn"],"created_at":"2024-11-08T11:47:28.718Z","updated_at":"2025-07-16T12:07:49.846Z","avatar_url":"https://github.com/crflynn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"skgrf\n=====\n\n|build| |wheels| |rtd| |pypi| |pyversions|\n\n.. |build| image:: https://github.com/crflynn/skgrf/workflows/build_and_test/badge.svg\n    :target: https://github.com/crflynn/skgrf/actions\n\n.. |wheels| image:: https://github.com/crflynn/skgrf-wheels/workflows/release/badge.svg\n    :target: https://github.com/crflynn/skgrf/actions\n\n.. |rtd| image:: https://img.shields.io/readthedocs/skgrf.svg\n    :target: http://skgrf.readthedocs.io/en/latest/\n\n.. |pypi| image:: https://img.shields.io/pypi/v/skgrf.svg\n    :target: https://pypi.python.org/pypi/skgrf\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/skgrf.svg\n    :target: https://pypi.python.org/pypi/skgrf\n\n``skgrf`` provides `scikit-learn \u003chttps://scikit-learn.org/stable/index.html\u003e`__ compatible Python bindings to the C++ random forest implementation, `grf \u003chttps://github.com/grf-labs/grf\u003e`__, using `Cython \u003chttps://cython.readthedocs.io/en/latest/\u003e`__.\n\nThe latest release of ``skgrf`` uses version `2.1.0 \u003chttps://github.com/grf-labs/grf/releases/tag/v2.1.0\u003e`__ of ``grf``.\n\n``skgrf`` is still in development. Please create issues for any discrepancies or errors. PRs welcome.\n\nDocumentation\n-------------\n\n* `stable \u003chttps://skgrf.readthedocs.io/en/stable/\u003e`__\n* `latest \u003chttps://skgrf.readthedocs.io/en/latest/\u003e`__\n\nInstallation\n------------\n\n``skgrf`` is available on `pypi \u003chttps://pypi.org/project/skgrf\u003e`__ and can be installed via pip:\n\n.. code-block:: bash\n\n    pip install skgrf\n\nEstimators\n----------\n\n* GRFForestCausalRegressor\n* GRFForestInstrumentalRegressor\n* GRFForestLocalLinearRegressor\n* GRFForestQuantileRegressor\n* GRFForestRegressor\n* GRFBoostedForestRegressor\n* GRFForestSurvival\n\nUsage\n-----\n\nGRFForestRegressor\n~~~~~~~~~~~~~~~~~~\n\nThe ``GRFForestRegressor`` predictor uses ``grf``'s RegressionPredictionStrategy class.\n\n.. code-block:: python\n\n    from sklearn.datasets import load_boston\n    from sklearn.model_selection import train_test_split\n    from skgrf.ensemble import GRFForestRegressor\n    \n    X, y = load_boston(return_X_y=True)\n    X_train, X_test, y_train, y_test = train_test_split(X, y)\n    \n    forest = GRFForestRegressor()\n    forest.fit(X_train, y_train)\n    \n    predictions = forest.predict(X_test)\n    print(predictions)\n    # [31.81349144 32.2734354  16.51560285 11.90284392 39.69744341 21.30367911\n    #  19.52732937 15.82126562 26.49528961 11.27220097 16.02447197 20.01224404\n    #  ...\n    #  20.70674263 17.09041289 12.89671205 20.79787926 21.18317924 25.45553279\n    #  20.82455595]\n\n\nGRFForestQuantileRegressor\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ``GRFForestQuantileRegressor`` predictor uses ``grf``'s QuantilePredictionStrategy class.\n\n.. code-block:: python\n\n    from sklearn.datasets import load_boston\n    from sklearn.model_selection import train_test_split\n    from skgrf.ensemble import GRFForestQuantileRegressor\n    \n    X, y = load_boston(return_X_y=True)\n    X_train, X_test, y_train, y_test = train_test_split(X, y)\n    \n    forest = GRFForestQuantileRegressor(quantiles=[0.1, 0.9])\n    forest.fit(X_train, y_train)\n    \n    predictions = forest.predict(X_test)\n    print(predictions)\n    # [[21.9 50. ]\n    # [ 8.5 24.5]\n    # ...\n    # [ 8.4 18.6]\n    # [ 8.1 20. ]]\n\nLicense\n-------\n\n``skgrf`` is licensed under `GPLv3 \u003chttps://github.com/crflynn/skgrf/blob/main/LICENSE.txt\u003e`__.\n\nDevelopment\n-----------\n\nTo 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.\n\nTo format code, run ``make fmt``. This will run isort and black against the .py files.\n\nTo run tests and inspect coverage, run ``make test`` or ``make xtest`` for testing in parallel.\n\nTo rebuild in place after making changes, run ``make build``.\n\nTo create python package artifacts, run ``make dist``.\n\nTo build and view documentation, run ``make docs``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrflynn%2Fskgrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrflynn%2Fskgrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrflynn%2Fskgrf/lists"}