8000 FIX utils.multiclass.type_of_target with numpy 1.24 dev (#24044) · scikit-learn/scikit-learn@cd14723 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd14723

Browse files
lestevejjerphan
andauthored
FIX utils.multiclass.type_of_target with numpy 1.24 dev (#24044)
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
1 parent 076442c commit cd14723

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sklearn/utils/multiclass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def is_multilabel(y):
150150
warnings.simplefilter("error", np.VisibleDeprecationWarning)
151151
try:
152152
y = np.asarray(y)
153-
except np.VisibleDeprecationWarning:
153+
except (np.VisibleDeprecationWarning, ValueError):
154154
# dtype=object should be provided explicitly for ragged arrays,
155155
# see NEP 34
156156
y = np.array(y, dtype=object)
@@ -292,7 +292,7 @@ def type_of_target(y, input_name=""):
292292
warnings.simplefilter("error", np.VisibleDeprecationWarning)
293293
try:
294294
y = np.asarray(y)
295-
except np.VisibleDeprecationWarning:
295+
except (np.VisibleDeprecationWarning, ValueError):
296296
# dtype=object should be provided explicitly for ragged arrays,
297297
# see NEP 34
298298
y = np.asarray(y, dtype=object)

0 commit comments

Comments
 (0)
0