From 17aea888d492720950009a3eb376531c48bdbae9 Mon Sep 17 00:00:00 2001 From: Brenton Date: Fri, 20 Sep 2024 22:24:57 -0400 Subject: [PATCH 1/3] upgrade minimum sklearn --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 4 ++-- docs/getting_started/installation.rst | 4 ++-- pyproject.toml | 4 ++-- quantile_forest/_min_dependencies.py | 2 +- quantile_forest/_quantile_forest.py | 6 +----- setup.py | 1 - 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da0723e0..7010455a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b8433829..3446b7ff 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,9 +21,9 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.20.0 env: - CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* + CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* CIBW_SKIP: pp* *i686* *win32 *musllinux* - CIBW_PROJECT_REQUIRES_PYTHON: '>=3.8,<3.13' + CIBW_PROJECT_REQUIRES_PYTHON: '>=3.9,<3.13' CIBW_BEFORE_BUILD: pip install --verbose --editable . CIBW_ARCHS_LINUX: auto64 CIBW_ARCHS_MACOS: x86_64 universal2 arm64 diff --git a/docs/getting_started/installation.rst b/docs/getting_started/installation.rst index 31686210..d05afc0e 100755 --- a/docs/getting_started/installation.rst +++ b/docs/getting_started/installation.rst @@ -8,9 +8,9 @@ Prerequisites The quantile-forest package requires the following dependencies: -* python (>=3.8) +* python (>=3.9) * numpy (>=1.23) -* scikit-learn (>=1.0) +* scikit-learn (>=1.5) * scipy (>=1.4) Installation diff --git a/pyproject.toml b/pyproject.toml index 5f31e76e..893092d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,13 +6,13 @@ requires = [ "Cython>=3.0a4", "numpy>=1.23", "scipy>=1.4", - "scikit-learn>=1.0", + "scikit-learn>=1.5", ] [tool.black] line-length = 99 preview = true -target_version = ["py38", "py39", "py310", "py311", "py312"] +target_version = ["py39", "py310", "py311", "py312"] [tool.cython-lint] ignore = ["E741"] diff --git a/quantile_forest/_min_dependencies.py b/quantile_forest/_min_dependencies.py index bd0d74b3..de80f04b 100644 --- a/quantile_forest/_min_dependencies.py +++ b/quantile_forest/_min_dependencies.py @@ -6,7 +6,7 @@ CYTHON_MIN_VERSION = "3.0a4" NUMPY_MIN_VERSION = "1.23" SCIPY_MIN_VERSION = "1.4" -SKLEARN_MIN_VERSION = "1.0" +SKLEARN_MIN_VERSION = "1.5" # 'build' and 'install' is included to have structured metadata for CI. # The values are (version_spec, comma separated tags). diff --git a/quantile_forest/_quantile_forest.py b/quantile_forest/_quantile_forest.py index 7a0c64ae..286d6991 100755 --- a/quantile_forest/_quantile_forest.py +++ b/quantile_forest/_quantile_forest.py @@ -95,7 +95,7 @@ def __init__( """Initialize base quantile forest regressor.""" init_dict = { ( - "base_estimator" if sklearn_version < parse_version("1.2.0") else "estimator" + "estimator" ): estimator, "n_estimators": n_estimators, "estimator_params": estimator_params, @@ -1357,8 +1357,6 @@ def __init__( "max_samples": max_samples, "max_samples_leaf": max_samples_leaf, } - if sklearn_version >= parse_version("1.4.0"): - init_dict["estimator_params"] += ("monotonic_cst",) super(RandomForestQuantileRegressor, self).__init__(**init_dict) self.default_quantiles = default_quantiles @@ -1690,8 +1688,6 @@ def __init__( "max_samples": max_samples, "max_samples_leaf": max_samples_leaf, } - if sklearn_version >= parse_version("1.4.0"): - init_dict["estimator_params"] += ("monotonic_cst",) super(ExtraTreesQuantileRegressor, self).__init__(**init_dict) self.default_quantiles = default_quantiles diff --git a/setup.py b/setup.py index bdcb4f06..8de816a5 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ def write_version_py(): "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", From 3e7ee95f5c9f40a1bc5a16c4ef33ffd272bd8ce2 Mon Sep 17 00:00:00 2001 From: Brenton Date: Sat, 21 Sep 2024 18:30:01 -0400 Subject: [PATCH 2/3] fix estimator params --- quantile_forest/_quantile_forest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quantile_forest/_quantile_forest.py b/quantile_forest/_quantile_forest.py index 286d6991..6c19851a 100755 --- a/quantile_forest/_quantile_forest.py +++ b/quantile_forest/_quantile_forest.py @@ -94,9 +94,7 @@ def __init__( ): """Initialize base quantile forest regressor.""" init_dict = { - ( - "estimator" - ): estimator, + "estimator": estimator, "n_estimators": n_estimators, "estimator_params": estimator_params, "bootstrap": bootstrap, @@ -1347,6 +1345,7 @@ def __init__( "min_impurity_decrease", "random_state", "ccp_alpha", + "monotonic_cst" ), "bootstrap": bootstrap, "oob_score": oob_score, @@ -1678,6 +1677,7 @@ def __init__( "min_impurity_decrease", "random_state", "ccp_alpha", + "monotonic_cst" ), "bootstrap": bootstrap, "oob_score": oob_score, From 9deec2b312702a7d7055053fb7af175c0fbda4e4 Mon Sep 17 00:00:00 2001 From: Brenton Date: Mon, 23 Sep 2024 09:42:05 -0400 Subject: [PATCH 3/3] pre-commit checks --- quantile_forest/_quantile_forest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quantile_forest/_quantile_forest.py b/quantile_forest/_quantile_forest.py index 6c19851a..412fe5d5 100755 --- a/quantile_forest/_quantile_forest.py +++ b/quantile_forest/_quantile_forest.py @@ -1345,7 +1345,7 @@ def __init__( "min_impurity_decrease", "random_state", "ccp_alpha", - "monotonic_cst" + "monotonic_cst", ), "bootstrap": bootstrap, "oob_score": oob_score, @@ -1677,7 +1677,7 @@ def __init__( "min_impurity_decrease", "random_state", "ccp_alpha", - "monotonic_cst" + "monotonic_cst", ), "bootstrap": bootstrap, "oob_score": oob_score,