diff --git a/tests/model_selection/test_keras.py b/tests/model_selection/test_keras.py index 7ea61b4ab..8b74307b0 100644 --- a/tests/model_selection/test_keras.py +++ b/tests/model_selection/test_keras.py @@ -46,17 +46,24 @@ def _keras_build_fn(lr=0.01): @gen_cluster(client=True, Worker=Nanny, timeout=20) def test_keras(c, s, a, b): # Mirror the mnist dataset - X, y = make_classification(n_classes=10, n_features=784, n_informative=100) + X, y = make_classification( + n_classes=10, n_features=784, n_informative=100, random_state=0 + ) X = X.astype("float32") assert y.dtype == np.dtype("int64") model = KerasClassifier( model=_keras_build_fn, lr=0.01, verbose=False, loss="categorical_crossentropy", ) - params = {"lr": loguniform(1e-3, 1e-1)} + params = {"lr": loguniform(1e-3, 1e-1), "random_state": [1]} search = IncrementalSearchCV( - model, params, max_iter=3, n_initial_parameters=5, decay_rate=None + model, + params, + max_iter=3, + n_initial_parameters=5, + decay_rate=None, + random_state=0, ) yield search.fit(X, y) # search.fit(X, y)