Skip to content

Commit

Permalink
fix test_nearest_neighbors_rbc test for haversine distance
Browse files Browse the repository at this point in the history
  • Loading branch information
benfred committed Sep 27, 2024
1 parent fdd18c5 commit 590865d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/cuml/cuml/tests/test_nearest_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,14 @@ def test_nearest_neighbors_rbc(distance_dims, n_neighbors, nrows):
X[:query_rows, :], n_neighbors=n_neighbors
)

assert len(brute_d[brute_d != rbc_d]) == 0
cp.testing.assert_allclose(brute_d, rbc_d, atol=1e-3, rtol=1e-3)

# All the distances match so allow a couple mismatched indices
# through from potential non-determinism in exact matching
# distances
assert len(brute_i[brute_i != rbc_i]) <= 3
assert (
len(brute_i[brute_i != rbc_i]) <= 3 if distance != "haversine" else 10
)


@pytest.mark.parametrize("metric", valid_metrics_sparse())
Expand Down

0 comments on commit 590865d

Please sign in to comment.