TST use global_random_seed in sklearn/_loss/tests/test_glm_distribution.py
@@ -101,9 +101,9 @@ def test_deviance_zero(family, chk_values):
],
ids=lambda x: x.__class__.__name__,
)
-def test_deviance_derivative(family):
+def test_deviance_derivative(family, global_random_seed):
"""Test deviance derivative for different families."""
- rng = np.random.RandomState(0)
+ rng = np.random.RandomState(global_random_seed)
y_true = rng.rand(10)
# make data positive
y_true += np.abs(y_true.min()) + 1e-2
@@ -120,4 +120,4 @@ def test_deviance_derivative(family):
lambda y_pred: family.deviance_derivative(y_true, y_pred),
y_pred,
) / np.linalg.norm(dev_derivative)
- assert abs(err) < 1e-6
+ assert abs(err) < 3e-6
