[med-svn] [Git][med-team/q2-sample-classifier][master] 7 commits: routine-update: New upstream version

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Sun Aug 20 13:35:17 BST 2023



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


Commits:
b856bf0d by Étienne Mollier at 2023-08-18T20:29:22+02:00
routine-update: New upstream version

- - - - -
5a1ef3f5 by Étienne Mollier at 2023-08-18T20:29:38+02:00
New upstream version 2023.7.0
- - - - -
44e15dc2 by Étienne Mollier at 2023-08-18T20:29:40+02:00
Update upstream source from tag 'upstream/2023.7.0'

Update to upstream version '2023.7.0'
with Debian dir 2618fa743e02c15eb038e44b557f7fb8e48e78c3
- - - - -
a22011a2 by Étienne Mollier at 2023-08-18T20:32:09+02:00
reduce-precision-in-tests.patch: refresh.

- - - - -
e2110e73 by Étienne Mollier at 2023-08-18T20:34:30+02:00
fix-autopkgtest.patch: refresh.

- - - - -
22d3f03e by Étienne Mollier at 2023-08-18T20:34:45+02:00
sklearn-1.2.1.patch: refresh.

- - - - -
3c081f04 by Étienne Mollier at 2023-08-20T14:34:31+02:00
d/changelog: update + todo item.

- - - - -


28 changed files:

- + .github/workflows/ci-dev.yaml
- − .github/workflows/ci.yml
- + .github/workflows/join-release.yaml
- + .github/workflows/tag-release.yaml
- LICENSE
- ci/recipe/meta.yaml
- debian/changelog
- debian/patches/fix-autopkgtest.patch
- debian/patches/reduce-precision-in-tests.patch
- debian/patches/sklearn-1.2.1.patch
- q2_sample_classifier/__init__.py
- q2_sample_classifier/_format.py
- q2_sample_classifier/_transformer.py
- q2_sample_classifier/_type.py
- q2_sample_classifier/_version.py
- q2_sample_classifier/classify.py
- q2_sample_classifier/plugin_setup.py
- q2_sample_classifier/tests/__init__.py
- q2_sample_classifier/tests/test_actions.py
- q2_sample_classifier/tests/test_base_class.py
- q2_sample_classifier/tests/test_classifier.py
- q2_sample_classifier/tests/test_estimators.py
- q2_sample_classifier/tests/test_types_formats_transformers.py
- q2_sample_classifier/tests/test_utilities.py
- q2_sample_classifier/tests/test_visualization.py
- q2_sample_classifier/utilities.py
- q2_sample_classifier/visuals.py
- setup.py


Changes:

=====================================
.github/workflows/ci-dev.yaml
=====================================
@@ -0,0 +1,12 @@
+# Example of workflow trigger for calling workflow (the client).
+name: ci-dev
+on:
+  pull_request:
+    branches: ["dev"]
+  push:
+    branches: ["dev"]
+jobs:
+  ci:
+    uses: qiime2/distributions/.github/workflows/lib-ci-dev.yaml at dev
+    with:
+      distro: core
\ No newline at end of file


=====================================
.github/workflows/ci.yml deleted
=====================================
@@ -1,55 +0,0 @@
-# This file is automatically generated by busywork.qiime2.org and
-# template-repos - any manual edits made to this file will be erased when
-# busywork performs maintenance updates.
-
-name: ci
-
-on:
-  pull_request:
-  push:
-    branches:
-      - master
-
-jobs:
-  lint:
-    runs-on: ubuntu-latest
-    steps:
-    - name: checkout source
-      uses: actions/checkout at v2
-
-    - name: set up python 3.8
-      uses: actions/setup-python at v1
-      with:
-        python-version: 3.8
-
-    - name: install dependencies
-      run: python -m pip install --upgrade pip
-
-    - name: lint
-      run: |
-        pip install -q https://github.com/qiime2/q2lint/archive/master.zip
-        q2lint
-        pip install -q flake8
-        flake8
-
-  build-and-test:
-    needs: lint
-    strategy:
-      matrix:
-        os: [ubuntu-latest, macos-latest]
-    runs-on: ${{ matrix.os }}
-    steps:
-    - name: checkout source
-      uses: actions/checkout at v2
-      with:
-        fetch-depth: 0
-
-    - name: set up git repo for versioneer
-      run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
-
-    - uses: qiime2/action-library-packaging at alpha1
-      with:
-        package-name: q2-sample-classifier
-        build-target: dev
-        additional-tests: py.test --pyargs q2_sample_classifier
-        library-token: ${{ secrets.LIBRARY_TOKEN }}


=====================================
.github/workflows/join-release.yaml
=====================================
@@ -0,0 +1,6 @@
+name: join-release
+on:
+  workflow_dispatch: {}
+jobs:
+  release:
+    uses: qiime2/distributions/.github/workflows/lib-join-release.yaml at dev
\ No newline at end of file


=====================================
.github/workflows/tag-release.yaml
=====================================
@@ -0,0 +1,7 @@
+name: tag-release
+on:
+  push:
+    branches: ["Release-*"]
+jobs:
+  tag:
+    uses: qiime2/distributions/.github/workflows/lib-tag-release.yaml at dev
\ No newline at end of file


=====================================
LICENSE
=====================================
@@ -1,6 +1,6 @@
 BSD 3-Clause License
 
-Copyright (c) 2017-2022, QIIME 2 development team.
+Copyright (c) 2017-2023, QIIME 2 development team.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without


=====================================
ci/recipe/meta.yaml
=====================================
@@ -32,6 +32,9 @@ requirements:
     - q2-feature-table {{ qiime2_epoch }}.*
 
 test:
+  commands:
+    - py.test --pyargs q2_sample_classifier
+    
   requires:
     - qiime2 >={{ qiime2 }}
     - q2-types >={{ q2_types }}


=====================================
debian/changelog
=====================================
@@ -1,3 +1,15 @@
+q2-sample-classifier (2023.7.0-1) UNRELEASED; urgency=medium
+
+ TODO: autopkgtest fails with two instances of:
+ AssertionError: <class 'str'> != <class 'sklearn.tree._classes.ExtraTreeClassifier'>
+
+  * New upstream version 2023.7.0
+  * reduce-precision-in-tests.patch: refresh.
+  * fix-autopkgtest.patch: refresh.
+  * sklearn-1.2.1.patch: refresh.
+
+ -- Étienne Mollier <emollier at debian.org>  Sun, 20 Aug 2023 14:32:50 +0200
+
 q2-sample-classifier (2022.11.1-3) unstable; urgency=medium
 
   * reduce-precision-in-tests.patch: unfuzz.


=====================================
debian/patches/fix-autopkgtest.patch
=====================================
@@ -2,9 +2,9 @@ Description: Fix autopkgtest errors that were failing due to sklearn changed API
 assignment of multi-dimensiondal array to pandas
 Author: Mohammed Bilal  <mdbilal at disroot.org>
 Last-Update: 2022-09-09
---- a/q2_sample_classifier/utilities.py
-+++ b/q2_sample_classifier/utilities.py
-@@ -253,7 +253,7 @@
+--- q2-sample-classifier.orig/q2_sample_classifier/utilities.py
++++ q2-sample-classifier/q2_sample_classifier/utilities.py
+@@ -257,7 +257,7 @@
           for n in range(len(rfecv.grid_scores_)-1, -1, -1)]
      if x[0] < 1:
          x[0] = 1
@@ -13,7 +13,7 @@ Last-Update: 2022-09-09
  
  
  def nested_cross_validation(table, metadata, cv, random_state, n_jobs,
-@@ -512,13 +512,13 @@
+@@ -516,13 +516,13 @@
      # (drop pipeline params and individual base estimators)
      estimator_params = {k: v for k, v in estimator.get_params().items() if
                          k.startswith('est__') and k != 'est__base_estimator'}
@@ -29,10 +29,10 @@ Last-Update: 2022-09-09
          rfep.savefig(join(output_dir, 'rfe_plot.png'))
          rfep.savefig(join(output_dir, 'rfe_plot.pdf'))
          plt.close('all')
-@@ -807,7 +807,7 @@
+@@ -821,7 +821,7 @@
      return Pipeline(
-         [('dv', base_estimator.named_steps.dv),
-          ('est', adaboost_estimator(base_estimator.named_steps.est,
+         [('dv', estimator.named_steps.dv),
+          ('est', adaboost_estimator(estimator.named_steps.est,
 -                                    n_estimators, random_state=random_state))])
 +                                    n_estimators=n_estimators, random_state=random_state))])
  


=====================================
debian/patches/reduce-precision-in-tests.patch
=====================================
@@ -5,7 +5,7 @@ Forwarded: yes
 Last-Update: 2021-07-25
 --- q2-sample-classifier.orig/q2_sample_classifier/tests/test_estimators.py
 +++ q2-sample-classifier/q2_sample_classifier/tests/test_estimators.py
-@@ -250,9 +250,9 @@
+@@ -253,9 +253,9 @@
                  pred, self.mdc_chard_fp.to_series(), 'ignore')
              accuracy = accuracy_score(truth, pred)
              self.assertAlmostEqual(
@@ -17,7 +17,7 @@ Last-Update: 2021-07-25
  
      # test if training classifier with pipeline classify_samples raises
      # warning when test_size = 0.0
-@@ -381,7 +381,7 @@
+@@ -386,7 +386,7 @@
                          regressor, accuracy, seeded_results[regressor]))
              else:
                  self.assertAlmostEqual(
@@ -26,7 +26,7 @@ Last-Update: 2021-07-25
                      msg='Accuracy of %s regressor was %f, but expected %f' % (
                          regressor, accuracy, seeded_results[regressor]))
  
-@@ -523,7 +523,7 @@
+@@ -544,7 +544,7 @@
                  self.assertAlmostEqual(
                      mse, seeded_predict_results[regressor],
                      msg='Accuracy of %s regressor was %f, but expected %f' % (


=====================================
debian/patches/sklearn-1.2.1.patch
=====================================
@@ -9,7 +9,7 @@ Last-Update: 2023-02-02
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- q2-sample-classifier.orig/q2_sample_classifier/tests/test_estimators.py
 +++ q2-sample-classifier/q2_sample_classifier/tests/test_estimators.py
-@@ -134,7 +134,7 @@
+@@ -135,7 +135,7 @@
          dv = DictVectorizer()
          dv.fit(dicts)
          features = table.ids('observation')
@@ -20,7 +20,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
              for feature, count in zip(features, table_row):
 --- q2-sample-classifier.orig/q2_sample_classifier/utilities.py
 +++ q2-sample-classifier/q2_sample_classifier/utilities.py
-@@ -234,7 +234,7 @@
+@@ -238,7 +238,7 @@
      # Describe top features
      n_opt = rfecv.named_steps.est.n_features_
      importance = _extract_important_features(
@@ -29,7 +29,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          rfecv.named_steps.est.ranking_)
      importance = sort_importances(importance, ascending=True)[:n_opt]
  
-@@ -248,9 +248,10 @@
+@@ -252,9 +252,10 @@
      # If using fractional step, step = integer of fraction * n_features
      if rfecv.step < 1:
          rfecv.step = int(rfecv.step * n_features)
@@ -42,7 +42,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      if x[0] < 1:
          x[0] = 1
      return pd.Series(rfecv.cv_results_['mean_test_score'], index=x, name='Accuracy')
-@@ -400,12 +401,12 @@
+@@ -404,12 +405,12 @@
      # feature_importances_ or coef_ to report feature importance/weights
      try:
          importances = _extract_important_features(
@@ -57,7 +57,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
              estimator.named_steps.est.coef_)
      return importances
  
-@@ -707,7 +708,7 @@
+@@ -711,7 +712,7 @@
  def _null_feature_importance(table):
      feature_extractor = DictVectorizer()
      feature_extractor.fit(table)


=====================================
q2_sample_classifier/__init__.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/_format.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/_transformer.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/_type.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_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 = " (HEAD -> master, tag: 2022.11.1)"
-    git_full = "f693e2087a65c868846472d3284c7ba9f00d4bfc"
-    git_date = "2022-12-21 22:30:20 +0000"
+    git_refnames = " (tag: 2023.7.0, Release-2023.7)"
+    git_full = "28215705a9e042fe0ac5b5c1a9313ec13e5d1d07"
+    git_date = "2023-08-17 19:35:51 +0000"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
q2_sample_classifier/classify.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/plugin_setup.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -155,12 +155,15 @@ parameter_descriptions = {
 
 classifiers = Str % Choices(
     ['RandomForestClassifier', 'ExtraTreesClassifier',
-     'GradientBoostingClassifier', 'AdaBoostClassifier',
+     'GradientBoostingClassifier',
+     'AdaBoostClassifier[DecisionTree]', 'AdaBoostClassifier[ExtraTrees]',
      'KNeighborsClassifier', 'LinearSVC', 'SVC'])
 
 regressors = Str % Choices(
     ['RandomForestRegressor', 'ExtraTreesRegressor',
-     'GradientBoostingRegressor', 'AdaBoostRegressor', 'ElasticNet',
+     'GradientBoostingRegressor',
+     'AdaBoostRegressor[DecisionTree]', 'AdaBoostRegressor[ExtraTrees]',
+     'ElasticNet',
      'Ridge', 'Lasso', 'KNeighborsRegressor', 'LinearSVR', 'SVR'])
 
 output_descriptions = {


=====================================
q2_sample_classifier/tests/__init__.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_actions.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_base_class.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_classifier.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_estimators.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -14,6 +14,7 @@ import json
 import numpy as np
 from sklearn.metrics import mean_squared_error, accuracy_score
 from sklearn.ensemble import AdaBoostClassifier
+from sklearn.tree import DecisionTreeClassifier, ExtraTreeClassifier
 from sklearn.feature_extraction import DictVectorizer
 from sklearn.pipeline import Pipeline
 import skbio
@@ -235,8 +236,10 @@ class EstimatorsTests(SampleClassifierTestPluginBase):
     # when a random seed is set.
     def test_classifiers(self):
         for classifier in ['RandomForestClassifier', 'ExtraTreesClassifier',
-                           'GradientBoostingClassifier', 'AdaBoostClassifier',
-                           'LinearSVC', 'SVC', 'KNeighborsClassifier']:
+                           'GradientBoostingClassifier',
+                           'AdaBoostClassifier[DecisionTree]',
+                           'AdaBoostClassifier[ExtraTrees]', 'LinearSVC',
+                           'SVC', 'KNeighborsClassifier']:
             table_fp = self.get_data_path('chardonnay.table.qza')
             table = qiime2.Artifact.load(table_fp)
             res = sample_classifier.actions.classify_samples(
@@ -356,9 +359,11 @@ class EstimatorsTests(SampleClassifierTestPluginBase):
     # when a random seed is set.
     def test_regressors(self):
         for regressor in ['RandomForestRegressor', 'ExtraTreesRegressor',
-                          'GradientBoostingRegressor', 'AdaBoostRegressor',
-                          'Lasso', 'Ridge', 'ElasticNet',
-                          'KNeighborsRegressor', 'LinearSVR', 'SVR']:
+                          'GradientBoostingRegressor',
+                          'AdaBoostRegressor[DecisionTree]',
+                          'AdaBoostRegressor[ExtraTrees]', 'Lasso', 'Ridge',
+                          'ElasticNet', 'KNeighborsRegressor', 'LinearSVR',
+                          'SVR']:
             table_fp = self.get_data_path('ecam-table-maturity.qza')
             table = qiime2.Artifact.load(table_fp)
             res = sample_classifier.actions.regress_samples(
@@ -386,13 +391,25 @@ class EstimatorsTests(SampleClassifierTestPluginBase):
                         regressor, accuracy, seeded_results[regressor]))
 
     # test adaboost base estimator trainer
-    def test_train_adaboost_base_estimator(self):
+    def test_train_adaboost_decision_tree(self):
         abe = _train_adaboost_base_estimator(
             self.table_chard_fp, self.mdc_chard_fp, 'Region',
             n_estimators=10, n_jobs=1, cv=3, random_state=None,
             parameter_tuning=True, classification=True,
-            missing_samples='ignore')
+            missing_samples='ignore', base_estimator="DecisionTree")
+        self.assertEqual(type(abe.named_steps.est), AdaBoostClassifier)
+        self.assertEqual(type(abe.named_steps.est.base_estimator),
+                         DecisionTreeClassifier)
+
+    def test_train_adaboost_extra_trees(self):
+        abe = _train_adaboost_base_estimator(
+            self.table_chard_fp, self.mdc_chard_fp, 'Region',
+            n_estimators=10, n_jobs=1, cv=3, random_state=None,
+            parameter_tuning=True, classification=True,
+            missing_samples='ignore', base_estimator="ExtraTrees")
         self.assertEqual(type(abe.named_steps.est), AdaBoostClassifier)
+        self.assertEqual(type(abe.named_steps.est.base_estimator),
+                         ExtraTreeClassifier)
 
     # test some invalid inputs/edge cases
     def test_invalids(self):
@@ -458,8 +475,10 @@ class EstimatorsTests(SampleClassifierTestPluginBase):
     # x, y, and z predicts the correct metadata values for those same samples.
     def test_predict_classifications(self):
         for classifier in ['RandomForestClassifier', 'ExtraTreesClassifier',
-                           'GradientBoostingClassifier', 'AdaBoostClassifier',
-                           'LinearSVC', 'SVC', 'KNeighborsClassifier']:
+                           'GradientBoostingClassifier',
+                           'AdaBoostClassifier[DecisionTree]',
+                           'AdaBoostClassifier[ExtraTrees]', 'LinearSVC',
+                           'SVC', 'KNeighborsClassifier']:
             estimator, importances = fit_classifier(
                 self.table_chard_fp, self.mdc_chard_fp, random_state=123,
                 n_estimators=2, estimator=classifier, n_jobs=1,
@@ -494,7 +513,9 @@ class EstimatorsTests(SampleClassifierTestPluginBase):
 
     def test_predict_regressions(self):
         for regressor in ['RandomForestRegressor', 'ExtraTreesRegressor',
-                          'GradientBoostingRegressor', 'AdaBoostRegressor',
+                          'GradientBoostingRegressor',
+                          'AdaBoostRegressor[DecisionTree]',
+                          'AdaBoostRegressor[ExtraTrees]',
                           'Lasso', 'Ridge', 'ElasticNet',
                           'KNeighborsRegressor', 'SVR', 'LinearSVR']:
             estimator, importances = fit_regressor(
@@ -558,14 +579,16 @@ seeded_results = {
     'RandomForestClassifier': 0.63636363636363635,
     'ExtraTreesClassifier': 0.454545454545,
     'GradientBoostingClassifier': 0.272727272727,
-    'AdaBoostClassifier': 0.272727272727,
+    'AdaBoostClassifier[DecisionTree]': 0.272727272727,
+    'AdaBoostClassifier[ExtraTrees]': 0.272727272727,
     'LinearSVC': 0.818182,
     'SVC': 0.36363636363636365,
     'KNeighborsClassifier': 0.363636363636,
     'RandomForestRegressor': 23.226508,
     'ExtraTreesRegressor': 19.725397,
     'GradientBoostingRegressor': 34.157100,
-    'AdaBoostRegressor': 30.920635,
+    'AdaBoostRegressor[DecisionTree]': 30.920635,
+    'AdaBoostRegressor[ExtraTrees]': 21.746031,
     'Lasso': 722.827623,
     'Ridge': 521.195194222418,
     'ElasticNet': 618.532273,
@@ -577,14 +600,16 @@ seeded_predict_results = {
     'RandomForestClassifier': 18,
     'ExtraTreesClassifier': 21,
     'GradientBoostingClassifier': 21,
-    'AdaBoostClassifier': 21,
+    'AdaBoostClassifier[DecisionTree]': 21,
+    'AdaBoostClassifier[ExtraTrees]': 21,
     'LinearSVC': 21,
     'SVC': 12,
     'KNeighborsClassifier': 14,
     'RandomForestRegressor': 7.4246031746,
     'ExtraTreesRegressor': 0.,
     'GradientBoostingRegressor': 50.1955883469,
-    'AdaBoostRegressor': 9.7857142857142865,
+    'AdaBoostRegressor[DecisionTree]': 9.7857142857142865,
+    'AdaBoostRegressor[ExtraTrees]': 33.95238095238095,
     'Lasso': 0.173138653701,
     'Ridge': 2.694020055323081e-05,
     'ElasticNet': 0.0614243397637,


=====================================
q2_sample_classifier/tests/test_types_formats_transformers.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_utilities.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/tests/test_visualization.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
q2_sample_classifier/utilities.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #
@@ -21,7 +21,10 @@ from sklearn.ensemble import (RandomForestRegressor, RandomForestClassifier,
 from sklearn.svm import SVR, SVC
 from sklearn.linear_model import Ridge, Lasso, ElasticNet
 from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor
-from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
+from sklearn.tree import (
+    DecisionTreeClassifier, DecisionTreeRegressor,
+    ExtraTreeClassifier, ExtraTreeRegressor
+)
 from sklearn.pipeline import Pipeline
 
 import q2templates
@@ -32,6 +35,7 @@ import pkg_resources
 from scipy.sparse import issparse
 from scipy.stats import randint
 import biom
+import re
 
 from .visuals import (_linear_regress, _plot_confusion_matrix, _plot_RFE,
                       _regplot_from_dataframe, _generate_roc_plots)
@@ -781,32 +785,42 @@ def _select_estimator(estimator, n_jobs, n_estimators, random_state=None):
     return param_dist, estimator
 
 
-def _train_adaboost_base_estimator(table, metadata, column, n_estimators,
-                                   n_jobs, cv, random_state=None,
+def _train_adaboost_base_estimator(table, metadata, column, base_estimator,
+                                   n_estimators, n_jobs, cv, random_state=None,
                                    parameter_tuning=False,
                                    classification=True,
                                    missing_samples='error'):
     param_dist = parameters['ensemble']
+
     if classification:
-        base_estimator = DecisionTreeClassifier()
+        base_est = {
+                    'DecisionTree': DecisionTreeClassifier(),
+                    'ExtraTrees': ExtraTreeClassifier()
+                    }
+        pipe_base_estimator = base_est[base_estimator]
         adaboost_estimator = AdaBoostClassifier
     else:
-        base_estimator = DecisionTreeRegressor()
+        base_est = {
+                    'DecisionTree': DecisionTreeRegressor(),
+                    'ExtraTrees': ExtraTreeRegressor()
+                    }
+        pipe_base_estimator = base_est[base_estimator]
         adaboost_estimator = AdaBoostRegressor
-    base_estimator = Pipeline(
-        [('dv', DictVectorizer()), ('est', base_estimator)])
+
+    estimator = Pipeline(
+        [('dv', DictVectorizer()), ('est', pipe_base_estimator)])
 
     if parameter_tuning:
         features, targets = _load_data(
             table, metadata, missing_samples=missing_samples)
         param_dist = _map_params_to_pipeline(param_dist)
         base_estimator = _tune_parameters(
-            features, targets[column], base_estimator, param_dist,
+            features, targets[column], estimator, param_dist,
             n_jobs=n_jobs, cv=cv, random_state=random_state).best_estimator_
 
     return Pipeline(
-        [('dv', base_estimator.named_steps.dv),
-         ('est', adaboost_estimator(base_estimator.named_steps.est,
+        [('dv', estimator.named_steps.dv),
+         ('est', adaboost_estimator(estimator.named_steps.est,
                                     n_estimators, random_state=random_state))])
 
 
@@ -830,10 +844,11 @@ def _set_parameters_and_estimator(estimator, table, metadata, column,
                                   parameter_tuning, classification=True,
                                   missing_samples='error'):
     # specify parameters and distributions to sample from for parameter tuning
-    if estimator in ['AdaBoostClassifier', 'AdaBoostRegressor']:
+    if estimator.startswith("AdaBoost"):
+        base_estimator = re.search(r"\[([A-Za-z]+)\]", estimator).group(1)
         estimator = _train_adaboost_base_estimator(
-            table, metadata, column, n_estimators, n_jobs, cv, random_state,
-            parameter_tuning, classification=classification,
+            table, metadata, column, base_estimator, n_estimators, n_jobs, cv,
+            random_state, parameter_tuning, classification=classification,
             missing_samples=missing_samples)
         parameter_tuning = False
         param_dist = None


=====================================
q2_sample_classifier/visuals.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #


=====================================
setup.py
=====================================
@@ -1,5 +1,5 @@
 # ----------------------------------------------------------------------------
-# Copyright (c) 2017-2022, QIIME 2 development team.
+# Copyright (c) 2017-2023, QIIME 2 development team.
 #
 # Distributed under the terms of the Modified BSD License.
 #



View it on GitLab: https://salsa.debian.org/med-team/q2-sample-classifier/-/compare/39768ee7cb33657fa588d48cfb4eb774c58741e7...3c081f0459c9a044c5d73475e247d8eaddb4f0a7

-- 
View it on GitLab: https://salsa.debian.org/med-team/q2-sample-classifier/-/compare/39768ee7cb33657fa588d48cfb4eb774c58741e7...3c081f0459c9a044c5d73475e247d8eaddb4f0a7
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/20230820/ecfed987/attachment-0001.htm>


More information about the debian-med-commit mailing list