Skip to content

Commit

Permalink
upgrade minimum sklearn (#92)
Browse files Browse the repository at this point in the history
* upgrade minimum sklearn

* fix estimator params

* pre-commit checks

---------

Co-authored-by: Brenton <[email protected]>
  • Loading branch information
brentonmallen1 and Brenton authored Sep 23, 2024
1 parent 72f8315 commit 6ad7ffb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
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
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion quantile_forest/_min_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 3 additions & 7 deletions quantile_forest/_quantile_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ def __init__(
):
"""Initialize base quantile forest regressor."""
init_dict = {
(
"base_estimator" if sklearn_version < parse_version("1.2.0") else "estimator"
): estimator,
"estimator": estimator,
"n_estimators": n_estimators,
"estimator_params": estimator_params,
"bootstrap": bootstrap,
Expand Down Expand Up @@ -1347,6 +1345,7 @@ def __init__(
"min_impurity_decrease",
"random_state",
"ccp_alpha",
"monotonic_cst",
),
"bootstrap": bootstrap,
"oob_score": oob_score,
Expand All @@ -1357,8 +1356,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
Expand Down Expand Up @@ -1680,6 +1677,7 @@ def __init__(
"min_impurity_decrease",
"random_state",
"ccp_alpha",
"monotonic_cst",
),
"bootstrap": bootstrap,
"oob_score": oob_score,
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6ad7ffb

Please sign in to comment.