8000 BLD numpy VisibleDeprecationWarning in test suite · Issue #18367 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

BLD numpy VisibleDeprecationWarning in test suite #18367

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

Closed
9 tasks done
cmarmo opened this issue Sep 9, 2020 · 4 comments · Fixed by #18423
Closed
9 tasks done

BLD numpy VisibleDeprecationWarning in test suite #18367

cmarmo opened this issue Sep 9, 2020 · 4 comments · Fixed by #18423
Assignees
Labels
module:test-suite everything related to our tests

Comments

@cmarmo
Copy link
Contributor
cmarmo commented Sep 9, 2020

See #5685.
Currently the test suite is producing a bunch of numpy VisibleDeprecationWarning.
Here a checklist

  • test_raise_value_error_multilabel_sequences:
  • test__check_targets
  • test_multilabel_binarizer_non_integer_labels
  • test_unique_labels_non_specific
  • test_is_multilabel
  • test_check_classification_targets
  • test_type_of_target

The command to reproduce them locally is (<name_of_the_test> is the name in the checklist)

pytest sklearn/ -k <name_of_the_test> -Werror -Wignore::sklearn.exceptions.SkipTestWarning

Some warnings are thrown from docstring tests:

  • sklearn.utils._to_object_array
  • sklearn.utils.multiclass.is_multilabel

The command to reproduce them locally is (<name_of_the_function> is the name of the function in the checklist)

pytest --doctest-modules sklearn/utils/ -k <name_of_the_function> -Werror
@OlehKSS
Copy link
Contributor
OlehKSS commented Sep 10, 2020

Hi, is anyone working on this issue? I have checked test_multiclass.py, which contains tests for:

  • test_type_of_target
  • test_is_multilabel
  • test_unique_labels_non_specific
  • test_check_classification_targets

The warnings are raised in multiclass.py by np.asarray, on lines 141 and 253, due to the fact that the input parameter y is a ragged nested sequence, e.g. y = [np.array([]), np.array([1, 2, 3])]. One way to solve this would be to provide a data type to that function y = np.asarray(y, dtype=object) in those specific cases, since it's the default behavior now.

@cmarmo
Copy link
Contributor Author
cmarmo commented Sep 11, 2020

Hi @OlehKSS , no pull requests are linked here for now, so feel free to work on it. Thanks!

@OlehKSS
Copy link
Contributor
OlehKSS commented Sep 11, 2020

take

@glemaitre
Copy link
Member

I think the two PRs are fine. I was wondering if we should explicitly error in the CI to catch future VisibleDeprecationWarning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:test-suite everything related to our tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0