diff options
author | Vinicius Monego <monego@posteo.net> | 2024-05-05 23:26:00 -0300 |
---|---|---|
committer | Vinicius Monego <monego@posteo.net> | 2024-07-05 23:04:15 -0300 |
commit | e1e36294ad83191c9a5d3bc2f8b2e5a5c4fc95c8 (patch) | |
tree | a90883bff6160f9da1ffb9e310275a798f7e259c | |
parent | d38d7d0839deda8ca28d204588e337f3ace2ebf9 (diff) | |
download | guix-e1e36294ad83191c9a5d3bc2f8b2e5a5c4fc95c8.tar.gz guix-e1e36294ad83191c9a5d3bc2f8b2e5a5c4fc95c8.zip |
gnu: python-scikit-optimize: Update to 0.10.2.
* gnu/packages/python-science.scm (python-scikit-optimize): Update to 0.10.2.
[source]: Switch to maintained repository. Remove compatibility patches and
snippet.
* gnu/packages/patches/python-scikit-optimize-1148.patch,
gnu/packages/patches/python-scikit-optimize-1150.patch: Remove files.
* gnu/local.mk (dist_patch_DATA): Remove them.
Change-Id: I6c23c93d3c256b0b97166f80eaeab7f2c7282c5f
-rw-r--r-- | gnu/local.mk | 2 | ||||
-rw-r--r-- | gnu/packages/patches/python-scikit-optimize-1148.patch | 32 | ||||
-rw-r--r-- | gnu/packages/patches/python-scikit-optimize-1150.patch | 275 | ||||
-rw-r--r-- | gnu/packages/python-science.scm | 19 |
4 files changed, 3 insertions, 325 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 11f393dac0..7db556fa56 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1979,8 +1979,6 @@ dist_patch_DATA = \ %D%/packages/patches/python-robotframework-atest.patch \ %D%/packages/patches/python-robotframework-source-date-epoch.patch \ %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \ - %D%/packages/patches/python-scikit-optimize-1148.patch \ - %D%/packages/patches/python-scikit-optimize-1150.patch \ %D%/packages/patches/python-typing-inspect-fix.patch \ %D%/packages/patches/python-unittest2-python3-compat.patch \ %D%/packages/patches/python-unittest2-remove-argparse.patch \ diff --git a/gnu/packages/patches/python-scikit-optimize-1148.patch b/gnu/packages/patches/python-scikit-optimize-1148.patch deleted file mode 100644 index 6ad854ab1e..0000000000 --- a/gnu/packages/patches/python-scikit-optimize-1148.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3a5d5eb90ec9d8d4905c05387748486157cadbbb Mon Sep 17 00:00:00 2001 -From: valtron <valtron2000@gmail.com> -Date: Tue, 14 Feb 2023 09:56:10 -0700 -Subject: [PATCH] `np.int` -> `int` - -`np.int is int` and it was deprecated in numpy 1.20: https://numpy.org/doc/1.20/release/1.20.0-notes.html#deprecations ---- - skopt/space/transformers.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/skopt/space/transformers.py b/skopt/space/transformers.py -index 68892952..f2dfb164 100644 ---- a/skopt/space/transformers.py -+++ b/skopt/space/transformers.py -@@ -259,7 +259,7 @@ def transform(self, X): - if (self.high - self.low) == 0.: - return X * 0. - if self.is_int: -- return (np.round(X).astype(np.int) - self.low) /\ -+ return (np.round(X).astype(int) - self.low) /\ - (self.high - self.low) - else: - return (X - self.low) / (self.high - self.low) -@@ -272,7 +272,7 @@ def inverse_transform(self, X): - raise ValueError("All values should be greater than 0.0") - X_orig = X * (self.high - self.low) + self.low - if self.is_int: -- return np.round(X_orig).astype(np.int) -+ return np.round(X_orig).astype(int) - return X_orig - - diff --git a/gnu/packages/patches/python-scikit-optimize-1150.patch b/gnu/packages/patches/python-scikit-optimize-1150.patch deleted file mode 100644 index 0cdf361a80..0000000000 --- a/gnu/packages/patches/python-scikit-optimize-1150.patch +++ /dev/null @@ -1,275 +0,0 @@ -From cd74e00d0e4f435d548444e1a5edc20155e371d7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20T=C3=B8rnes?= <jonas.tornes@gmail.com> -Date: Wed, 15 Feb 2023 18:47:52 +0100 -Subject: [PATCH 1/5] Update RandomForesetRegressor criterion to be inline with - scikit-learn change from mse to squared error this has the same funcitonality - ---- - requirements.txt | 6 +++--- - setup.py | 6 +++--- - skopt/learning/forest.py | 30 +++++++++++++++--------------- - 3 files changed, 21 insertions(+), 21 deletions(-) - -diff --git a/requirements.txt b/requirements.txt -index 1eaa3083a..23ab3d856 100644 ---- a/requirements.txt -+++ b/requirements.txt -@@ -1,6 +1,6 @@ --numpy>=1.13.3 --scipy>=0.19.1 --scikit-learn>=0.20 -+numpy>=1.23.2 -+scipy>=1.10.0 -+scikit-learn>=1.2.1 - matplotlib>=2.0.0 - pytest - pyaml>=16.9 -diff --git a/setup.py b/setup.py -index 8879da880..e7f921765 100644 ---- a/setup.py -+++ b/setup.py -@@ -42,9 +42,9 @@ - classifiers=CLASSIFIERS, - packages=['skopt', 'skopt.learning', 'skopt.optimizer', 'skopt.space', - 'skopt.learning.gaussian_process', 'skopt.sampler'], -- install_requires=['joblib>=0.11', 'pyaml>=16.9', 'numpy>=1.13.3', -- 'scipy>=0.19.1', -- 'scikit-learn>=0.20.0'], -+ install_requires=['joblib>=0.11', 'pyaml>=16.9', 'numpy>=1.23.2', -+ 'scipy>=1.10.0', -+ 'scikit-learn>=1.2.1'], - extras_require={ - 'plots': ["matplotlib>=2.0.0"] - } -diff --git a/skopt/learning/forest.py b/skopt/learning/forest.py -index 096770c1d..ebde568f5 100644 ---- a/skopt/learning/forest.py -+++ b/skopt/learning/forest.py -@@ -27,7 +27,7 @@ def _return_std(X, trees, predictions, min_variance): - ------- - std : array-like, shape=(n_samples,) - Standard deviation of `y` at `X`. If criterion -- is set to "mse", then `std[i] ~= std(y | X[i])`. -+ is set to "squared_error", then `std[i] ~= std(y | X[i])`. - - """ - # This derives std(y | x) as described in 4.3.2 of arXiv:1211.0906 -@@ -61,9 +61,9 @@ class RandomForestRegressor(_sk_RandomForestRegressor): - n_estimators : integer, optional (default=10) - The number of trees in the forest. - -- criterion : string, optional (default="mse") -+ criterion : string, optional (default="squared_error") - The function to measure the quality of a split. Supported criteria -- are "mse" for the mean squared error, which is equal to variance -+ are "squared_error" for the mean squared error, which is equal to variance - reduction as feature selection criterion, and "mae" for the mean - absolute error. - -@@ -194,7 +194,7 @@ class RandomForestRegressor(_sk_RandomForestRegressor): - .. [1] L. Breiman, "Random Forests", Machine Learning, 45(1), 5-32, 2001. - - """ -- def __init__(self, n_estimators=10, criterion='mse', max_depth=None, -+ def __init__(self, n_estimators=10, criterion='squared_error', max_depth=None, - min_samples_split=2, min_samples_leaf=1, - min_weight_fraction_leaf=0.0, max_features='auto', - max_leaf_nodes=None, min_impurity_decrease=0., -@@ -228,20 +228,20 @@ def predict(self, X, return_std=False): - Returns - ------- - predictions : array-like of shape = (n_samples,) -- Predicted values for X. If criterion is set to "mse", -+ Predicted values for X. If criterion is set to "squared_error", - then `predictions[i] ~= mean(y | X[i])`. - - std : array-like of shape=(n_samples,) - Standard deviation of `y` at `X`. If criterion -- is set to "mse", then `std[i] ~= std(y | X[i])`. -+ is set to "squared_error", then `std[i] ~= std(y | X[i])`. - - """ - mean = super(RandomForestRegressor, self).predict(X) - - if return_std: -- if self.criterion != "mse": -+ if self.criterion != "squared_error": - raise ValueError( -- "Expected impurity to be 'mse', got %s instead" -+ "Expected impurity to be 'squared_error', got %s instead" - % self.criterion) - std = _return_std(X, self.estimators_, mean, self.min_variance) - return mean, std -@@ -257,9 +257,9 @@ class ExtraTreesRegressor(_sk_ExtraTreesRegressor): - n_estimators : integer, optional (default=10) - The number of trees in the forest. - -- criterion : string, optional (default="mse") -+ criterion : string, optional (default="squared_error") - The function to measure the quality of a split. Supported criteria -- are "mse" for the mean squared error, which is equal to variance -+ are "squared_error" for the mean squared error, which is equal to variance - reduction as feature selection criterion, and "mae" for the mean - absolute error. - -@@ -390,7 +390,7 @@ class ExtraTreesRegressor(_sk_ExtraTreesRegressor): - .. [1] L. Breiman, "Random Forests", Machine Learning, 45(1), 5-32, 2001. - - """ -- def __init__(self, n_estimators=10, criterion='mse', max_depth=None, -+ def __init__(self, n_estimators=10, criterion='squared_error', max_depth=None, - min_samples_split=2, min_samples_leaf=1, - min_weight_fraction_leaf=0.0, max_features='auto', - max_leaf_nodes=None, min_impurity_decrease=0., -@@ -425,19 +425,19 @@ def predict(self, X, return_std=False): - Returns - ------- - predictions : array-like of shape=(n_samples,) -- Predicted values for X. If criterion is set to "mse", -+ Predicted values for X. If criterion is set to "squared_error", - then `predictions[i] ~= mean(y | X[i])`. - - std : array-like of shape=(n_samples,) - Standard deviation of `y` at `X`. If criterion -- is set to "mse", then `std[i] ~= std(y | X[i])`. -+ is set to "squared_error", then `std[i] ~= std(y | X[i])`. - """ - mean = super(ExtraTreesRegressor, self).predict(X) - - if return_std: -- if self.criterion != "mse": -+ if self.criterion != "squared_error": - raise ValueError( -- "Expected impurity to be 'mse', got %s instead" -+ "Expected impurity to be 'squared_error', got %s instead" - % self.criterion) - std = _return_std(X, self.estimators_, mean, self.min_variance) - return mean, std - -From 6eb2d4ddaa299ae47d9a69ffb31ebc4ed366d1c1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20T=C3=B8rnes?= <jonas.tornes@gmail.com> -Date: Thu, 16 Feb 2023 11:34:58 +0100 -Subject: [PATCH 2/5] Change test to be consistent with code changes. - ---- - skopt/learning/tests/test_forest.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/skopt/learning/tests/test_forest.py b/skopt/learning/tests/test_forest.py -index 0711cde9d..c6ed610f3 100644 ---- a/skopt/learning/tests/test_forest.py -+++ b/skopt/learning/tests/test_forest.py -@@ -35,7 +35,7 @@ def test_random_forest(): - assert_array_equal(clf.predict(T), true_result) - assert 10 == len(clf) - -- clf = RandomForestRegressor(n_estimators=10, criterion="mse", -+ clf = RandomForestRegressor(n_estimators=10, criterion="squared_error", - max_depth=None, min_samples_split=2, - min_samples_leaf=1, - min_weight_fraction_leaf=0., -@@ -80,7 +80,7 @@ def test_extra_forest(): - assert_array_equal(clf.predict(T), true_result) - assert 10 == len(clf) - -- clf = ExtraTreesRegressor(n_estimators=10, criterion="mse", -+ clf = ExtraTreesRegressor(n_estimators=10, criterion="squared_error", - max_depth=None, min_samples_split=2, - min_samples_leaf=1, min_weight_fraction_leaf=0., - max_features="auto", max_leaf_nodes=None, - -From 52c620add07d845debbaff2ce2b1c5faf3eae79b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20T=C3=B8rnes?= <jonas.tornes@gmail.com> -Date: Wed, 22 Feb 2023 16:59:03 +0100 -Subject: [PATCH 3/5] Update skopt/learning/forest.py -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fix max line width - -Co-authored-by: Roland Laurès <roland@laures-valdivia.net> ---- - skopt/learning/forest.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/skopt/learning/forest.py b/skopt/learning/forest.py -index ebde568f5..07dc42664 100644 ---- a/skopt/learning/forest.py -+++ b/skopt/learning/forest.py -@@ -194,8 +194,8 @@ class RandomForestRegressor(_sk_RandomForestRegressor): - .. [1] L. Breiman, "Random Forests", Machine Learning, 45(1), 5-32, 2001. - - """ -- def __init__(self, n_estimators=10, criterion='squared_error', max_depth=None, -- min_samples_split=2, min_samples_leaf=1, -+ def __init__(self, n_estimators=10, criterion='squared_error', -+ max_depth=None, min_samples_split=2, min_samples_leaf=1, - min_weight_fraction_leaf=0.0, max_features='auto', - max_leaf_nodes=None, min_impurity_decrease=0., - bootstrap=True, oob_score=False, - -From 52a7db95cb567186fb4e9003139fea4592bdbf05 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20T=C3=B8rnes?= <jonas.tornes@gmail.com> -Date: Wed, 22 Feb 2023 17:03:25 +0100 -Subject: [PATCH 4/5] Fix line widht issues - ---- - skopt/learning/forest.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/skopt/learning/forest.py b/skopt/learning/forest.py -index 07dc42664..d4c24456b 100644 ---- a/skopt/learning/forest.py -+++ b/skopt/learning/forest.py -@@ -390,8 +390,8 @@ class ExtraTreesRegressor(_sk_ExtraTreesRegressor): - .. [1] L. Breiman, "Random Forests", Machine Learning, 45(1), 5-32, 2001. - - """ -- def __init__(self, n_estimators=10, criterion='squared_error', max_depth=None, -- min_samples_split=2, min_samples_leaf=1, -+ def __init__(self, n_estimators=10, criterion='squared_error', -+ max_depth=None, min_samples_split=2, min_samples_leaf=1, - min_weight_fraction_leaf=0.0, max_features='auto', - max_leaf_nodes=None, min_impurity_decrease=0., - bootstrap=False, oob_score=False, - -From 6b185e489fb4a56625e8505292a20c80434f0633 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20T=C3=B8rnes?= <jonas.tornes@gmail.com> -Date: Wed, 22 Feb 2023 18:37:11 +0100 -Subject: [PATCH 5/5] Fix lin width issues for comments. - ---- - skopt/learning/forest.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/skopt/learning/forest.py b/skopt/learning/forest.py -index d4c24456b..eb3bd6648 100644 ---- a/skopt/learning/forest.py -+++ b/skopt/learning/forest.py -@@ -63,9 +63,9 @@ class RandomForestRegressor(_sk_RandomForestRegressor): - - criterion : string, optional (default="squared_error") - The function to measure the quality of a split. Supported criteria -- are "squared_error" for the mean squared error, which is equal to variance -- reduction as feature selection criterion, and "mae" for the mean -- absolute error. -+ are "squared_error" for the mean squared error, which is equal to -+ variance reduction as feature selection criterion, and "mae" for the -+ mean absolute error. - - max_features : int, float, string or None, optional (default="auto") - The number of features to consider when looking for the best split: -@@ -259,9 +259,9 @@ class ExtraTreesRegressor(_sk_ExtraTreesRegressor): - - criterion : string, optional (default="squared_error") - The function to measure the quality of a split. Supported criteria -- are "squared_error" for the mean squared error, which is equal to variance -- reduction as feature selection criterion, and "mae" for the mean -- absolute error. -+ are "squared_error" for the mean squared error, which is equal to -+ variance reduction as feature selection criterion, and "mae" for the -+ mean absolute error. - - max_features : int, float, string or None, optional (default="auto") - The number of features to consider when looking for the best split: diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 57b852c2bd..8ba3432637 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -567,29 +567,16 @@ swarm algorithm.") (define-public python-scikit-optimize (package (name "python-scikit-optimize") - (version "0.9.0") + (version "0.10.2") (source (origin (method git-fetch) (uri (git-reference - (url "https://github.com/scikit-optimize/scikit-optimize") + (url "https://github.com/holgern/scikit-optimize") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 - "0hsq6pmryimxc275yrcy4bv217bx7ma6rz0q6m4138bv4zgq18d1")) - (patches - ;; These are for compatibility with more recent versions of - ;; numpy and scikit-learn. - (search-patches "python-scikit-optimize-1148.patch" - "python-scikit-optimize-1150.patch")) - (modules '((guix build utils))) - (snippet - ;; Since scikit-learn 1.3 max_features no longer supports - ;; 'auto', which is identical to 'sqrt' - '(substitute* '("skopt/learning/forest.py" - "skopt/learning/tests/test_forest.py") - (("max_features=['\"]auto['\"]") - "max_features='sqrt'"))))) + "0pc6avzxz8l32km5jvv3maih0a5x2akxybvxl2hdg04qz2l0kz8b")))) (build-system pyproject-build-system) (propagated-inputs (list python-joblib |