diff --git a/mlxtend/feature_selection/exhaustive_feature_selector.py b/mlxtend/feature_selection/exhaustive_feature_selector.py index 93552edf4..754ea87dd 100644 --- a/mlxtend/feature_selection/exhaustive_feature_selector.py +++ b/mlxtend/feature_selection/exhaustive_feature_selector.py @@ -34,7 +34,8 @@ def _calc_score(selector, X, y, indices, groups=None, **fit_params): scoring=selector.scorer, n_jobs=1, pre_dispatch=selector.pre_dispatch, - fit_params=fit_params) + fit_params=fit_params, + error_score=-np.inf) else: selector.est_.fit(X[:, indices], y, **fit_params) scores = np.array([selector.scorer(selector.est_, X[:, indices], y)]) diff --git a/mlxtend/feature_selection/sequential_feature_selector.py b/mlxtend/feature_selection/sequential_feature_selector.py index b65c0f696..f64e215b1 100644 --- a/mlxtend/feature_selection/sequential_feature_selector.py +++ b/mlxtend/feature_selection/sequential_feature_selector.py @@ -32,7 +32,8 @@ def _calc_score(selector, X, y, indices, groups=None, **fit_params): scoring=selector.scorer, n_jobs=1, pre_dispatch=selector.pre_dispatch, - fit_params=fit_params) + fit_params=fit_params, + error_score=-np.inf) else: selector.est_.fit(X[:, indices], y, **fit_params) scores = np.array([selector.scorer(selector.est_, X[:, indices], y)])