Hello community,
here is the log from the commit of package python-scikit-learn for
openSUSE:Factory checked in at 2020-10-25 18:10:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-scikit-learn (Old)
and /work/SRC/openSUSE:Factory/.python-scikit-learn.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-scikit-learn"
Sun Oct 25 18:10:15 2020 rev:11 rq:841689 version:0.23.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-scikit-learn/python-scikit-learn.changes
2020-08-17 12:04:03.190649887 +0200
+++
/work/SRC/openSUSE:Factory/.python-scikit-learn.new.3463/python-scikit-learn.changes
2020-10-25 18:10:20.811556909 +0100
@@ -1,0 +2,7 @@
+Tue Oct 13 22:49:47 UTC 2020 - Matej Cepl <[email protected]>
+
+- Add assert_allclose-for-FP-comparison.patch to overcome
+ equality comparison for FP numbers
+ (gh#scikit-learn/scikit-learn#18031).
+
+-------------------------------------------------------------------
New:
----
assert_allclose-for-FP-comparison.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-scikit-learn.spec ++++++
--- /var/tmp/diff_new_pack.KjAx6a/_old 2020-10-25 18:10:22.363558377 +0100
+++ /var/tmp/diff_new_pack.KjAx6a/_new 2020-10-25 18:10:22.367558381 +0100
@@ -25,6 +25,9 @@
License: BSD-3-Clause
URL: https://scikit-learn.org/
Source0:
https://files.pythonhosted.org/packages/source/s/scikit-learn/scikit-learn-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM assert_allclose-for-FP-comparison.patch
gh#scikit-learn/scikit-learn#18031 [email protected]
+# Use assert_allclose instead of equality in FP comparison
+Patch0: assert_allclose-for-FP-comparison.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy-devel >= 1.13.3}
@@ -58,11 +61,19 @@
scipy.
%prep
-%setup -q -n scikit-learn-%{version}
+%autosetup -p1 -n scikit-learn-%{version}
+
rm -rf sklearn/.pytest_cache
%build
%python_build
+%{python_expand for d in %{buildroot}%{$python_sitelib}
%{buildroot}%{$python_sitearch}; do \
+if [ -d $d ]; then
+ # find $d -name \*.pyc -delete
+ $python -m compileall $d
+ $python -O -m compileall $d
+fi
+done }
%install
%python_install
++++++ assert_allclose-for-FP-comparison.patch ++++++
>From 2964854e4579c88935d29f3229c32642448f2015 Mon Sep 17 00:00:00 2001
From: Christian Kastner <[email protected]>
Date: Sat, 1 Aug 2020 08:00:37 +0200
Subject: [PATCH] TST: Use assert_allclose instead of equality in FP comparison
Closes: #18031
---
sklearn/decomposition/tests/test_pca.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/sklearn/decomposition/tests/test_pca.py
+++ b/sklearn/decomposition/tests/test_pca.py
@@ -633,7 +633,8 @@ def test_assess_dimesion_rank_one():
n_samples, n_features = 9, 6
X = np.ones((n_samples, n_features)) # rank 1 matrix
_, s, _ = np.linalg.svd(X, full_matrices=True)
- assert sum(s[1:]) == 0 # except for rank 1, all eigenvalues are 0
+ # except for rank 1, all eigenvalues are 0 resp. close to 0 (FP)
+ assert_allclose(s[1:], np.zeros(n_features-1), atol=1e-12)
assert np.isfinite(_assess_dimension(s, rank=1, n_samples=n_samples))
for rank in range(2, n_features):