Skip to content

Commit 6e023c7

Browse files
glemaitrealfaro96
andauthored
MNT use bool instead of np.bool_ to silence FutureWarning [scipy-dev] (scikit-learn#19267)
Co-authored-by: Juan Carlos Alfaro Jiménez <JuanCarlos.Alfaro@uclm.es>
1 parent 1f26735 commit 6e023c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/cluster/tests/test_optics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_nowarn_if_metric_bool_data_bool():
220220
# https://github.com/scikit-learn/scikit-learn/issues/18996
221221

222222
pairwise_metric = 'rogerstanimoto'
223-
X = np.random.randint(2, size=(5, 2), dtype=np.bool)
223+
X = np.random.randint(2, size=(5, 2), dtype=bool)
224224

225225
with pytest.warns(None) as warn_record:
226226
OPTICS(metric=pairwise_metric).fit(X)
@@ -234,7 +234,7 @@ def test_warn_if_metric_bool_data_no_bool():
234234
# https://github.com/scikit-learn/scikit-learn/issues/18996
235235

236236
pairwise_metric = 'rogerstanimoto'
237-
X = np.random.randint(2, size=(5, 2), dtype=np.int)
237+
X = np.random.randint(2, size=(5, 2), dtype=np.int32)
238238
msg = f"Data will be converted to boolean for metric {pairwise_metric}"
239239

240240
with pytest.warns(DataConversionWarning, match=msg) as warn_record:
@@ -246,8 +246,8 @@ def test_nowarn_if_metric_no_bool():
246246
# make sure no conversion warning is raised if
247247
# metric isn't boolean, no matter what the data type is
248248
pairwise_metric = 'minkowski'
249-
X_bool = np.random.randint(2, size=(5, 2), dtype=np.bool)
250-
X_num = np.random.randint(2, size=(5, 2), dtype=np.int)
249+
X_bool = np.random.randint(2, size=(5, 2), dtype=bool)
250+
X_num = np.random.randint(2, size=(5, 2), dtype=np.int32)
251251

252252
with pytest.warns(None) as warn_record:
253253
# fit boolean data

0 commit comments

Comments
 (0)