@@ -39,7 +39,7 @@ def test_neighbors_accuracy_with_n_candidates():
39
39
40
40
for i , n_candidates in enumerate (n_candidates_values ):
41
41
lshf = LSHForest (n_candidates = n_candidates )
42
- lshf .fit (X )
42
+ ignore_warnings ( lshf .fit ) (X )
43
43
for j in range (n_iter ):
44
44
query = X [rng .randint (0 , n_samples )].reshape (1 , - 1 )
45
45
@@ -74,7 +74,7 @@ def test_neighbors_accuracy_with_n_estimators():
74
74
75
75
for i , t in enumerate (n_estimators ):
76
76
lshf = LSHForest (n_candidates = 500 , n_estimators = t )
77
- lshf .fit (X )
77
+ ignore_warnings ( lshf .fit ) (X )
78
78
for j in range (n_iter ):
79
79
query = X [rng .randint (0 , n_samples )].reshape (1 , - 1 )
80
80
neighbors = lshf .kneighbors (query , n_neighbors = n_points ,
@@ -111,7 +111,7 @@ def test_kneighbors():
111
111
# Test unfitted estimator
112
112
assert_raises (ValueError , lshf .kneighbors , X [0 ])
113
113
114
- lshf .fit (X )
114
+ ignore_warnings ( lshf .fit ) (X )
115
115
116
116
for i in range (n_iter ):
117
117
n_neighbors = rng .randint (0 , n_samples )
@@ -162,7 +162,7 @@ def test_radius_neighbors():
162
162
# Test unfitted estimator
163
163
assert_raises (ValueError , lshf .radius_neighbors , X [0 ])
164
164
165
- lshf .fit (X )
165
+ ignore_warnings ( lshf .fit ) (X )
166
166
167
167
for i in range (n_iter ):
168
168
# Select a random point in the dataset as the query
@@ -218,6 +218,7 @@ def test_radius_neighbors():
218
218
sorted_dists_approx )))
219
219
220
220
221
+ @ignore_warnings
221
222
def test_radius_neighbors_boundary_handling ():
222
223
X = [[0.999 , 0.001 ], [0.5 , 0.5 ], [0 , 1. ], [- 1. , 0.001 ]]
223
224
n_points = len (X )
@@ -286,7 +287,7 @@ def test_distances():
286
287
X = rng .rand (n_samples , n_features )
287
288
288
289
lshf = LSHForest ()
289
- lshf .fit (X )
290
+ ignore_warnings ( lshf .fit ) (X )
290
291
291
292
for i in range (n_iter ):
292
293
n_neighbors = rng .randint (0 , n_samples )
@@ -312,7 +313,7 @@ def test_fit():
312
313
X = rng .rand (n_samples , n_features )
313
314
314
315
lshf = LSHForest (n_estimators = n_estimators )
315
- lshf .fit (X )
316
+ ignore_warnings ( lshf .fit ) (X )
316
317
317
318
# _input_array = X
318
319
assert_array_equal (X , lshf ._fit_X )
@@ -343,16 +344,16 @@ def test_partial_fit():
343
344
lshf = LSHForest ()
344
345
345
346
# Test unfitted estimator
346
- lshf .partial_fit (X )
347
+ ignore_warnings ( lshf .partial_fit ) (X )
347
348
assert_array_equal (X , lshf ._fit_X )
348
349
349
- lshf .fit (X )
350
+ ignore_warnings ( lshf .fit ) (X )
350
351
351
352
# Insert wrong dimension
352
353
assert_raises (ValueError , lshf .partial_fit ,
353
354
np .random .randn (n_samples_partial_fit , n_features - 1 ))
354
355
355
- lshf .partial_fit (X_partial_fit )
356
+ ignore_warnings ( lshf .partial_fit ) (X_partial_fit )
356
357
357
358
# size of _input_array = samples + 1 after insertion
358
359
assert_equal (lshf ._fit_X .shape [0 ],
@@ -379,7 +380,7 @@ def test_hash_functions():
379
380
380
381
lshf = LSHForest (n_estimators = n_estimators ,
381
382
random_state = rng .randint (0 , np .iinfo (np .int32 ).max ))
382
- lshf .fit (X )
383
+ ignore_warnings ( lshf .fit ) (X )
383
384
384
385
hash_functions = []
385
386
for i in range (n_estimators ):
@@ -405,7 +406,7 @@ def test_candidates():
405
406
406
407
# For zero candidates
407
408
lshf = LSHForest (min_hash_match = 32 )
408
- lshf .fit (X_train )
409
+ ignore_warnings ( lshf .fit ) (X_train )
409
410
410
411
message = ("Number of candidates is not sufficient to retrieve"
411
412
" %i neighbors with"
@@ -419,7 +420,7 @@ def test_candidates():
419
420
420
421
# For candidates less than n_neighbors
421
422
lshf = LSHForest (min_hash_match = 31 )
422
- lshf .fit (X_train )
423
+ ignore_warnings ( lshf .fit ) (X_train )
423
424
424
425
message = ("Number of candidates is not sufficient to retrieve"
425
426
" %i neighbors with"
@@ -441,7 +442,7 @@ def test_graphs():
441
442
for n_samples in n_samples_sizes :
442
443
X = rng .rand (n_samples , n_features )
443
444
lshf = LSHForest (min_hash_match = 0 )
444
- lshf .fit (X )
445
+ ignore_warnings ( lshf .fit ) (X )
445
446
446
447
kneighbors_graph = lshf .kneighbors_graph (X )
447
448
radius_neighbors_graph = lshf .radius_neighbors_graph (X )
0 commit comments