diff options
author | Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org> | 2023-12-14 19:06:53 +0100 |
---|---|---|
committer | Étienne Mollier <emollier@debian.org> | 2023-12-14 19:06:53 +0100 |
commit | d957910e1da7e61dc6eafd5e62149f40872fdd0f (patch) | |
tree | 430507570c440887d9194cb8e734e3266214d20d | |
parent | a58ad05e431c15eb17733e46f7a0de224bee63ce (diff) |
Fix autopkgtest errors that were failing due to sklearn changed API and
assignment of multi-dimensiondal array to pandas
Author: Mohammed Bilal <mdbilal@disroot.org>
Last-Update: 2022-09-09
Gbp-Pq: Name fix-autopkgtest.patch
-rw-r--r-- | q2_sample_classifier/utilities.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/q2_sample_classifier/utilities.py b/q2_sample_classifier/utilities.py index 334044c..06d7778 100644 --- a/q2_sample_classifier/utilities.py +++ b/q2_sample_classifier/utilities.py @@ -257,7 +257,7 @@ def _extract_rfe_scores(rfecv): for n in range(len(rfecv.grid_scores_)-1, -1, -1)] if x[0] < 1: x[0] = 1 - return pd.Series(rfecv.grid_scores_, index=x, name='Accuracy') + return pd.Series(rfecv.cv_results_['mean_test_score'], index=x, name='Accuracy') def nested_cross_validation(table, metadata, cv, random_state, n_jobs, @@ -516,13 +516,13 @@ def _extract_estimator_parameters(estimator): # (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'} - return pd.Series(estimator_params, name='Parameter setting') + return pd.Series(list(estimator_params), name='Parameter setting') def _summarize_estimator(output_dir, sample_estimator): try: rfep = _plot_RFE( - x=sample_estimator.rfe_scores.index, y=sample_estimator.rfe_scores) + x=sample_estimator.rfe_scores.index, y=np.stack(sample_estimator.rfe_scores.values)) rfep.savefig(join(output_dir, 'rfe_plot.png')) rfep.savefig(join(output_dir, 'rfe_plot.pdf')) plt.close('all') @@ -821,7 +821,7 @@ def _train_adaboost_base_estimator(table, metadata, column, base_estimator, return Pipeline( [('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))]) def _disable_feature_selection(estimator, optimize_feature_selection): |