Skip to content

Commit 2e6a2d7

Browse files
committed
FIX incorrect test (#881)
1 parent 467c557 commit 2e6a2d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

imblearn/over_sampling/_smote/tests/test_geometric_smote.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_gsmote_fit_resample_binary(
157157
n_maj, n_min, step, min_coor, max_coor = 12, 5, 0.5, 0.0, 8.5
158158
X = np.repeat(np.arange(min_coor, max_coor, step), 2).reshape(-1, 2)
159159
y = np.concatenate([np.repeat(0, n_maj), np.repeat(1, n_min)])
160-
radius = np.sqrt(0.5) * step
160+
max_radius = np.sqrt(np.sum((X[-1] - X[n_maj - 1]) ** 2))
161161
k_neighbors = 1
162162
gsmote = GeometricSMOTE(
163163
"auto",
@@ -170,7 +170,7 @@ def test_gsmote_fit_resample_binary(
170170
X_resampled, y_resampled = gsmote.fit_resample(X, y)
171171
assert gsmote.sampling_strategy_ == {1: (n_maj - n_min)}
172172
assert y_resampled.sum() == n_maj
173-
np.testing.assert_array_less(X[n_maj - 1] - radius, X_resampled[n_maj + n_min])
173+
np.testing.assert_array_less(X[-1] - max_radius, X_resampled[n_maj + n_min])
174174

175175

176176
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)