Skip to content

Commit d360ffa

Browse files
thomasjpfanjnothman
authored andcommitted
[MRG] TST Increases tolerance to match float32 resolution (#14184)
1 parent b8ab214 commit d360ffa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sklearn/linear_model/tests/test_ridge.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,13 +1099,14 @@ def test_dtype_match(solver):
10991099
X_32 = X_64.astype(np.float32)
11001100
y_32 = y_64.astype(np.float32)
11011101

1102+
tol = 2 * np.finfo(np.float32).resolution
11021103
# Check type consistency 32bits
1103-
ridge_32 = Ridge(alpha=alpha, solver=solver, max_iter=500, tol=1e-10,)
1104+
ridge_32 = Ridge(alpha=alpha, solver=solver, max_iter=500, tol=tol)
11041105
ridge_32.fit(X_32, y_32)
11051106
coef_32 = ridge_32.coef_
11061107

11071108
# Check type consistency 64 bits
1108-
ridge_64 = Ridge(alpha=alpha, solver=solver, max_iter=500, tol=1e-10,)
1109+
ridge_64 = Ridge(alpha=alpha, solver=solver, max_iter=500, tol=tol)
11091110
ridge_64.fit(X_64, y_64)
11101111
coef_64 = ridge_64.coef_
11111112

0 commit comments

Comments
 (0)