[med-svn] [Git][med-team/q2-feature-classifier][upstream] New upstream version 2024.5.0

Michael R. Crusoe (@crusoe) gitlab at salsa.debian.org
Wed Jun 26 14:19:08 BST 2024



Michael R. Crusoe pushed to branch upstream at Debian Med / q2-feature-classifier


Commits:
7f0ea9e4 by Michael R. Crusoe at 2024-06-26T14:40:56+02:00
New upstream version 2024.5.0
- - - - -


5 changed files:

- q2_feature_classifier/_skl.py
- q2_feature_classifier/_version.py
- q2_feature_classifier/classifier.py
- q2_feature_classifier/tests/test_classifier.py
- q2_feature_classifier/tests/test_custom.py


Changes:

=====================================
q2_feature_classifier/_skl.py
=====================================
@@ -61,7 +61,7 @@ _specific_fitters = [
            {'__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/_version.py
=====================================
@@ -23,9 +23,9 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (tag: 2024.2.0, Release-2024.2)"
-    git_full = "5ce76be5b72482a7d033fb9d2c41446edd75851a"
-    git_date = "2024-02-16 21:57:24 +0000"
+    git_refnames = " (tag: 2024.5.0, Release-2024.5)"
+    git_full = "d14730e4fc0447415705d0084b17f18f7e6b4d82"
+    git_date = "2024-05-29 04:15:35 +0000"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
q2_feature_classifier/classifier.py
=====================================
@@ -86,6 +86,8 @@ def spec_from_pipeline(pipeline):
 
 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__'})
@@ -206,11 +208,8 @@ def classify_sklearn(reads: DNAFASTAFormat, classifier: Pipeline,
                      read_orientation: str = 'auto'
                      ) -> pd.DataFrame:
 
-    if n_jobs in (0, -1):
+    if n_jobs == 0:
         n_jobs = get_available_cores()
-    elif n_jobs < -1:
-        n_less = abs(n_jobs + 1)
-        n_jobs = get_available_cores(n_less=n_less)
 
     try:
         # autotune reads per batch
@@ -266,11 +265,9 @@ _parameter_descriptions = {
     'reads_per_batch': 'Number of reads to process in each batch. If "auto", '
                        'this parameter is autoscaled to '
                        'min( number of query sequences / n_jobs, 20000).',
-    'n_jobs': 'The maximum number of concurrent worker processes. If -1 '
+    'n_jobs': 'The maximum number of concurrent worker processes. If 0 '
               'all CPUs are used. If 1 is given, no parallel computing '
-              'code is used at all, which is useful for debugging. For '
-              'n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for '
-              'n_jobs = -2, all CPUs but one are used.',
+              'code is used at all, which is useful for debugging.',
     'pre_dispatch': '"all" or expression, as in "3*n_jobs". The number of '
                     'batches (of tasks) to be pre-dispatched.'
 }
@@ -332,6 +329,8 @@ def _register_fitter(name, spec):
                 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:


=====================================
q2_feature_classifier/tests/test_classifier.py
=====================================
@@ -66,7 +66,7 @@ class ClassifierTests(FeatureClassifierTestPluginBase):
                      {'__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 @@ class ClassifierTests(FeatureClassifierTestPluginBase):
                      {'__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/tests/test_custom.py
=====================================
@@ -39,7 +39,7 @@ class CustomTests(FeatureClassifierTestPluginBase):
                 {'__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 @@ class CustomTests(FeatureClassifierTestPluginBase):
 
         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)



View it on GitLab: https://salsa.debian.org/med-team/q2-feature-classifier/-/commit/7f0ea9e45bb89d8970805e330fd00645c040be3a

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/med-team/q2-feature-classifier/-/commit/7f0ea9e45bb89d8970805e330fd00645c040be3a
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/20240626/b92893e3/attachment-0001.htm>


More information about the debian-med-commit mailing list