8000 FIX: np.ones_like does not support dtype on old numpy · Felixhawk/scikit-learn@a4db8e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4db8e2

Browse files
committed
FIX: np.ones_like does not support dtype on old numpy
1 parent b1aea57 commit a4db8e2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sklearn/linear_model/tests/test_ransac.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def test_ransac_inliers_outliers():
3131
ransac_estimator.fit(X, y)
3232

3333
# Ground truth / reference inlier mask
34-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
35-
dtype=np.bool_)
34+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
35+
).astype(np.bool_)
3636
ref_inlier_mask[outliers] = False
3737

3838
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)
@@ -144,8 +144,8 @@ def test_ransac_sparse_coo():
144144
residual_threshold=5, random_state=0)
145145
ransac_estimator.fit(X_sparse, y)
146146

147-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
148-
dtype=np.bool_)
147+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
148+
).astype(np.bool_)
149149
ref_inlier_mask[outliers] = False
150150

151151
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)
@@ -159,8 +159,8 @@ def test_ransac_sparse_csr():
159159
residual_threshold=5, random_state=0)
160160
ransac_estimator.fit(X_sparse, y)
161161

162-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
163-
dtype=np.bool_)
162+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
163+
).astype(np.bool_)
164164
ref_inlier_mask[outliers] = False
165165

166166
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)
@@ -174,8 +174,8 @@ def test_ransac_sparse_csc():
174174
residual_threshold=5, random_state=0)
175175
ransac_estimator.fit(X_sparse, y)
176176

177-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
178-
dtype=np.bool_)
177+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
178+
).astype(np.bool_)
179179
ref_inlier_mask[outliers] = False
180180

181181
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)
@@ -240,8 +240,8 @@ def test_ransac_multi_dimensional_targets():
240240
ransac_estimator.fit(X, yyy)
241241

242242
# Ground truth / reference inlier mask
243-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
244-
dtype=np.bool_)
243+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
244+
).astype(np.bool_)
245245
ref_inlier_mask[outliers] = False
246246

247247
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)
@@ -286,8 +286,8 @@ def test_ransac_default_residual_threshold():
286286
ransac_estimator.fit(X, y)
287287

288288
# Ground truth / reference inlier mask
289-
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_,
290-
dtype=np.bool_)
289+
ref_inlier_mask = np.ones_like(ransac_estimator.inlier_mask_
290+
).astype(np.bool_)
291291
ref_inlier_mask[outliers] = False
292292

293293
assert_equal(ransac_estimator.inlier_mask_, ref_inlier_mask)

0 commit comments

Comments
 (0)
0