Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure with sklearn 1.6.0 #160

Closed
penguinpee opened this issue Dec 21, 2024 · 1 comment · Fixed by #161
Closed

Test failure with sklearn 1.6.0 #160

penguinpee opened this issue Dec 21, 2024 · 1 comment · Fixed by #161
Labels
bug Something isn't working

Comments

@penguinpee
Copy link

System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Fedora 42 (rawhide)
Sklearn-genetic-opt version: 0.11.1
Scikit-learn version: 1.6.0
Python version: 3.13.1

Describe the bug
Two tests fail with sklearn 1.6.0:

=================================== FAILURES ===================================
____________________________ test_negative_criteria ____________________________
sklearn_genetic/tests/test_feature_selection.py:208: in test_negative_criteria
    evolved_estimator.fit(X_train_b, y_train_b)
sklearn_genetic/genetic_search.py:1138: in fit
    self.scorer_ = check_scoring(self.estimator, self.scoring)
/usr/lib64/python3.13/site-packages/sklearn/utils/_param_validation.py:206: in wrapper
    validate_parameter_constraints(
/usr/lib64/python3.13/site-packages/sklearn/utils/_param_validation.py:98: in validate_parameter_constraints
    raise InvalidParameterError(
E   sklearn.utils._param_validation.InvalidParameterError: The 'scoring' parameter of check_scoring must be a str among {'adjusted_mutual_info_score', 'precision_weighted', 'jaccard_micro', 'f1_samples', 'explained_variance', 'f1_macro', 'neg_median_absolute_error', 'neg_root_mean_squared_error', 'roc_auc_ovo', 'f1_micro', 'rand_score', 'recall', 'jaccard_samples', 'precision', 'neg_mean_absolute_percentage_error', 'neg_negative_likelihood_ratio', 'neg_mean_gamma_deviance', 'recall_samples', 'r2', 'precision_micro', 'neg_mean_absolute_error', 'neg_log_loss', 'neg_mean_squared_error', 'positive_likelihood_ratio', 'recall_weighted', 'f1_weighted', 'normalized_mutual_info_score', 'roc_auc_ovr_weighted', 'precision_macro', 'jaccard_weighted', 'd2_absolute_error_score', 'neg_max_error', 'recall_macro', 'roc_auc_ovr', 'f1', 'top_k_accuracy', 'neg_brier_score', 'roc_auc', 'matthews_corrcoef', 'jaccard_macro', 'accuracy', 'average_precision', 'neg_mean_poisson_deviance', 'neg_mean_squared_log_error', 'neg_root_mean_squared_log_error', 'homogeneity_score', 'fowlkes_mallows_score', 'precision_samples', 'roc_auc_ovo_weighted', 'mutual_info_score', 'completeness_score', 'adjusted_rand_score', 'balanced_accuracy', 'v_measure_score', 'jaccard', 'recall_micro'}, a callable, an instance of 'list', an instance of 'set', an instance of 'tuple', an instance of 'dict' or None. Got 'max_error' instead.
____________________________ test_negative_criteria ____________________________
sklearn_genetic/tests/test_genetic_search.py:277: in test_negative_criteria
    evolved_estimator.fit(X_train_b, y_train_b)
sklearn_genetic/genetic_search.py:531: in fit
    self.scorer_ = check_scoring(self.estimator, self.scoring)
/usr/lib64/python3.13/site-packages/sklearn/utils/_param_validation.py:206: in wrapper
    validate_parameter_constraints(
/usr/lib64/python3.13/site-packages/sklearn/utils/_param_validation.py:98: in validate_parameter_constraints
    raise InvalidParameterError(
E   sklearn.utils._param_validation.InvalidParameterError: The 'scoring' parameter of check_scoring must be a str among {'adjusted_mutual_info_score', 'precision_weighted', 'jaccard_micro', 'f1_samples', 'explained_variance', 'f1_macro', 'neg_median_absolute_error', 'neg_root_mean_squared_error', 'roc_auc_ovo', 'f1_micro', 'rand_score', 'recall', 'jaccard_samples', 'precision', 'neg_mean_absolute_percentage_error', 'neg_negative_likelihood_ratio', 'neg_mean_gamma_deviance', 'recall_samples', 'r2', 'precision_micro', 'neg_mean_absolute_error', 'neg_log_loss', 'neg_mean_squared_error', 'positive_likelihood_ratio', 'recall_weighted', 'f1_weighted', 'normalized_mutual_info_score', 'roc_auc_ovr_weighted', 'precision_macro', 'jaccard_weighted', 'd2_absolute_error_score', 'neg_max_error', 'recall_macro', 'roc_auc_ovr', 'f1', 'top_k_accuracy', 'neg_brier_score', 'roc_auc', 'matthews_corrcoef', 'jaccard_macro', 'accuracy', 'average_precision', 'neg_mean_poisson_deviance', 'neg_mean_squared_log_error', 'neg_root_mean_squared_log_error', 'homogeneity_score', 'fowlkes_mallows_score', 'precision_samples', 'roc_auc_ovo_weighted', 'mutual_info_score', 'completeness_score', 'adjusted_rand_score', 'balanced_accuracy', 'v_measure_score', 'jaccard', 'recall_micro'}, a callable, an instance of 'list', an instance of 'set', an instance of 'tuple', an instance of 'dict' or None. Got 'max_error' instead.
=========================== short test summary info ============================
FAILED sklearn_genetic/tests/test_feature_selection.py::test_negative_criteria - sklearn.utils._param_validation.InvalidParameterError: The 'scoring' parameter of check_scoring must be a str among {'adjusted_mutual_info_score', 'precision_weighted', 'jaccard_micro', 'f1_samples', 'explained_variance', 'f1_macro', 'neg_median_absolute_error', 'neg_root_mean_squared_error', 'roc_auc_ovo', 'f1_micro', 'rand_score', 'recall', 'jaccard_samples', 'precision', 'neg_mean_absolute_percentage_error', 'neg_negative_likelihood_ratio', 'neg_mean_gamma_deviance', 'recall_samples', 'r2', 'precision_micro', 'neg_mean_absolute_error', 'neg_log_loss', 'neg_mean_squared_error', 'positive_likelihood_ratio', 'recall_weighted', 'f1_weighted', 'normalized_mutual_info_score', 'roc_auc_ovr_weighted', 'precision_macro', 'jaccard_weighted', 'd2_absolute_error_score', 'neg_max_error', 'recall_macro', 'roc_auc_ovr', 'f1', 'top_k_accuracy', 'neg_brier_score', 'roc_auc', 'matthews_corrcoef', 'jaccard_macro', 'accuracy', 'average_precision', 'neg_mean_poisson_deviance', 'neg_mean_squared_log_error', 'neg_root_mean_squared_log_error', 'homogeneity_score', 'fowlkes_mallows_score', 'precision_samples', 'roc_auc_ovo_weighted', 'mutual_info_score', 'completeness_score', 'adjusted_rand_score', 'balanced_accuracy', 'v_measure_score', 'jaccard', 'recall_micro'}, a callable, an instance of 'list', an instance of 'set', an instance of 'tuple', an instance of 'dict' or None. Got 'max_error' instead.
FAILED sklearn_genetic/tests/test_genetic_search.py::test_negative_criteria - sklearn.utils._param_validation.InvalidParameterError: The 'scoring' parameter of check_scoring must be a str among {'adjusted_mutual_info_score', 'precision_weighted', 'jaccard_micro', 'f1_samples', 'explained_variance', 'f1_macro', 'neg_median_absolute_error', 'neg_root_mean_squared_error', 'roc_auc_ovo', 'f1_micro', 'rand_score', 'recall', 'jaccard_samples', 'precision', 'neg_mean_absolute_percentage_error', 'neg_negative_likelihood_ratio', 'neg_mean_gamma_deviance', 'recall_samples', 'r2', 'precision_micro', 'neg_mean_absolute_error', 'neg_log_loss', 'neg_mean_squared_error', 'positive_likelihood_ratio', 'recall_weighted', 'f1_weighted', 'normalized_mutual_info_score', 'roc_auc_ovr_weighted', 'precision_macro', 'jaccard_weighted', 'd2_absolute_error_score', 'neg_max_error', 'recall_macro', 'roc_auc_ovr', 'f1', 'top_k_accuracy', 'neg_brier_score', 'roc_auc', 'matthews_corrcoef', 'jaccard_macro', 'accuracy', 'average_precision', 'neg_mean_poisson_deviance', 'neg_mean_squared_log_error', 'neg_root_mean_squared_log_error', 'homogeneity_score', 'fowlkes_mallows_score', 'precision_samples', 'roc_auc_ovo_weighted', 'mutual_info_score', 'completeness_score', 'adjusted_rand_score', 'balanced_accuracy', 'v_measure_score', 'jaccard', 'recall_micro'}, a callable, an instance of 'list', an instance of 'set', an instance of 'tuple', an instance of 'dict' or None. Got 'max_error' instead.
============ 2 failed, 110 passed, 6 deselected in 88.46s (0:01:28) ============

Fedora is in the process of updating NumPy. To make scikit-learn work with numpy 2.2.0 it was updated to version 1.6.0. With that update I'm seeing above test failures.

@penguinpee penguinpee added the bug Something isn't working label Dec 21, 2024
@musicinmybrain
Copy link
Contributor

musicinmybrain commented Jan 23, 2025

This can be reproduced by:

$ git clone https://github.com/rodrigo-arenas/Sklearn-genetic-opt.git
$ cd Sklearn-genetic-opt
$ python3.13 -m venv _e
$ . _e/bin/activate
(_e) $ pip install -e .
(_e) $ pip install -r <(sed '/tensorflow/d' dev-requirements.txt)
(_e) $ python -m pytest -v

(When I do that, I also get a few other errors that I haven’t investigated.)

The problem is that the max_error string name for the scoring metric was replaced with neg_max_error in scikit-learn/scikit-learn#29417 / scikit-learn/scikit-learn#29462. This was supposed to be a deprecation, but the error shows that it ended up being a removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants