[med-svn] [Git][med-team/q2-feature-classifier][master] 2 commits: sklearn-1.2.1.patch: add; fix most test failures with sklearn 1.2.1.

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Wed Feb 1 23:32:42 GMT 2023



Étienne Mollier pushed to branch master at Debian Med / q2-feature-classifier


Commits:
c9165dd9 by Étienne Mollier at 2023-02-02T00:31:07+01:00
sklearn-1.2.1.patch: add; fix most test failures with sklearn 1.2.1.

- - - - -
ea31738a by Étienne Mollier at 2023-02-02T00:32:11+01:00
update changelog

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/series
- + debian/patches/sklearn-1.2.1.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,11 +1,13 @@
 q2-feature-classifier (2022.11.1-2) UNRELEASED; urgency=medium
 
+  [ Andreas Tille ]
   * Team upload
   * Upload to unstable
-  TODO: Test issues with sklern 1.2.1 which are reported upstream
-        https://github.com/qiime2/q2-feature-classifier/issues/187
 
- -- Andreas Tille <tille at debian.org>  Tue, 24 Jan 2023 18:46:38 +0100
+  [ Étienne Mollier ]
+  * sklearn-1.2.1.patch: add; fix most test failures with sklearn 1.2.1.
+
+ -- Étienne Mollier <emollier at debian.org>  Thu, 02 Feb 2023 00:31:36 +0100
 
 q2-feature-classifier (2022.11.1-1) experimental; urgency=medium
 


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+sklearn-1.2.1.patch


=====================================
debian/patches/sklearn-1.2.1.patch
=====================================
@@ -0,0 +1,80 @@
+Description: fix test failures with sklearn 1.2.1
+ This patch works around an issue with scikit-learn not being tolerant about
+ ngram_range being a list instead of a tuple anymore, and the json module
+ tending to forcefully convert tuples from specifications into lists.
+Author: Étienne Mollier <emollier at debian.org>
+Bug: https://github.com/qiime2/q2-feature-classifier/issues/187
+Last-Update: 2023-02-02
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- q2-feature-classifier.orig/q2_feature_classifier/_skl.py
++++ q2-feature-classifier/q2_feature_classifier/_skl.py
+@@ -17,7 +17,7 @@
+            {'__type__': 'feature_extraction.text.HashingVectorizer',
+             'analyzer': 'char_wb',
+             'n_features': 8192,
+-            'ngram_range': [7, 7],
++            'ngram_range': (7, 7),
+             'alternate_sign': False}],
+           ['classify',
+            {'__type__': 'custom.LowMemoryMultinomialNB',
+--- q2-feature-classifier.orig/q2_feature_classifier/tests/test_classifier.py
++++ q2-feature-classifier/q2_feature_classifier/tests/test_classifier.py
+@@ -66,7 +66,7 @@
+                      {'__type__': 'feature_extraction.text.HashingVectorizer',
+                       'analyzer': 'char_wb',
+                       'n_features': 8192,
+-                      'ngram_range': [8, 8],
++                      'ngram_range': (8, 8),
+                       'alternate_sign': False}],
+                     ['classify',
+                      {'__type__': 'naive_bayes.GaussianNB'}]]
+@@ -117,7 +117,7 @@
+                      {'__type__': 'feature_extraction.text.HashingVectorizer',
+                       'analyzer': 'char_wb',
+                       'n_features': 8192,
+-                      'ngram_range': [8, 8],
++                      'ngram_range': (8, 8),
+                       'alternate_sign': False}],
+                     ['classify',
+                      {'__type__': 'linear_model.LogisticRegression'}]]
+--- q2-feature-classifier.orig/q2_feature_classifier/tests/test_custom.py
++++ q2-feature-classifier/q2_feature_classifier/tests/test_custom.py
+@@ -39,7 +39,7 @@
+                 {'__type__': 'feature_extraction.text.HashingVectorizer',
+                  'analyzer': 'char',
+                  'n_features': 8192,
+-                 'ngram_range': [8, 8],
++                 'ngram_range': (8, 8),
+                  'alternate_sign': False}],
+                 ['classify',
+                  {'__type__': 'custom.LowMemoryMultinomialNB',
+@@ -68,7 +68,7 @@
+ 
+         params = {'analyzer': 'char',
+                   'n_features': 8192,
+-                  'ngram_range': [8, 8],
++                  'ngram_range': (8, 8),
+                   'alternate_sign': False}
+         hv = HashingVectorizer(**params)
+         unchunked = hv.fit_transform(X)
+--- q2-feature-classifier.orig/q2_feature_classifier/classifier.py
++++ q2-feature-classifier/q2_feature_classifier/classifier.py
+@@ -84,6 +84,8 @@
+ 
+ def pipeline_from_spec(spec):
+     def as_steps(obj):
++        if 'ngram_range' in obj:
++            obj['ngram_range'] = tuple(obj['ngram_range'])
+         if '__type__' in obj:
+             klass = _load_class(obj['__type__'])
+             return klass(**{k: v for k, v in obj.items() if k != '__type__'})
+@@ -323,6 +325,8 @@
+                 kwargs[param] = json.loads(kwargs[param])
+             except (json.JSONDecodeError, TypeError):
+                 pass
++            if param == 'feat_ext__ngram_range':
++                kwargs[param] = tuple(kwargs[param])
+         pipeline = pipeline_from_spec(spec)
+         pipeline.set_params(**kwargs)
+         if class_weight is not None:



View it on GitLab: https://salsa.debian.org/med-team/q2-feature-classifier/-/compare/371f5c4a070b1a26d8dcac5be49cdbde68dacd46...ea31738a1a4fe352277bbdfc3ac368de21b1f1f6

-- 
View it on GitLab: https://salsa.debian.org/med-team/q2-feature-classifier/-/compare/371f5c4a070b1a26d8dcac5be49cdbde68dacd46...ea31738a1a4fe352277bbdfc3ac368de21b1f1f6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230201/dffbeabc/attachment-0001.htm>


More information about the debian-med-commit mailing list