diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index 1948b4a106..1e08803ba4 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -5,6 +5,7 @@ Release Notes * Enhancements * Fixes * Changes + * Removed DeprecationWarning for SimpleImputer :pr:`1018` * Documentation Changes * Testing Changes diff --git a/evalml/pipelines/components/transformers/imputers/simple_imputer.py b/evalml/pipelines/components/transformers/imputers/simple_imputer.py index b25b68980a..e8cb33e7c7 100644 --- a/evalml/pipelines/components/transformers/imputers/simple_imputer.py +++ b/evalml/pipelines/components/transformers/imputers/simple_imputer.py @@ -1,5 +1,3 @@ -import warnings - import pandas as pd from sklearn.impute import SimpleImputer as SkImputer @@ -20,8 +18,6 @@ def __init__(self, impute_strategy="most_frequent", fill_value=None, random_stat fill_value (string): When impute_strategy == "constant", fill_value is used to replace missing data. Defaults to 0 when imputing numerical data and "missing_value" for strings or object data types. """ - warnings.warn("SimpleImputer is deprecated in v0.12.0 and will be removed in 0.13.0 in favor of Imputer", DeprecationWarning) - parameters = {"impute_strategy": impute_strategy, "fill_value": fill_value} parameters.update(kwargs) diff --git a/evalml/tests/component_tests/test_feature_selectors.py b/evalml/tests/component_tests/test_feature_selectors.py index f20921316c..e639fd75e8 100644 --- a/evalml/tests/component_tests/test_feature_selectors.py +++ b/evalml/tests/component_tests/test_feature_selectors.py @@ -1,5 +1,9 @@ +import pandas as pd +import pytest + from evalml.pipelines.components import ( ComponentBase, + FeatureSelector, RFClassifierSelectFromModel, RFRegressorSelectFromModel ) @@ -38,3 +42,18 @@ def test_component_fit(X_y_binary, X_y_multi, X_y_regression): assert isinstance(rf_classifier.fit(X_binary, y_binary), ComponentBase) assert isinstance(rf_classifier.fit(X_multi, y_multi), ComponentBase) assert isinstance(rf_regressor.fit(X_reg, y_reg), ComponentBase) + + +def test_feature_selector_missing_component_obj(): + class MockFeatureSelector(FeatureSelector): + name = "Mock Feature Selector" + + def fit(self, X, y): + pass + + mock_feature_selector = MockFeatureSelector() + mock_feature_selector.fit(pd.DataFrame(), pd.Series()) + with pytest.raises(RuntimeError, match="Transformer requires a transform method or a component_obj that implements transform"): + mock_feature_selector.transform(pd.DataFrame()) + with pytest.raises(RuntimeError, match="Transformer requires a fit_transform method or a component_obj that implements fit_transform"): + mock_feature_selector.fit_transform(pd.DataFrame()) diff --git a/evalml/tests/component_tests/test_simple_imputer.py b/evalml/tests/component_tests/test_simple_imputer.py index c76e74c08e..8590708230 100644 --- a/evalml/tests/component_tests/test_simple_imputer.py +++ b/evalml/tests/component_tests/test_simple_imputer.py @@ -1,5 +1,3 @@ -import warnings - import numpy as np import pandas as pd import pytest @@ -151,12 +149,3 @@ def test_numpy_input(): np.testing.assert_almost_equal(X, np.array([[np.nan, 0, 1, np.nan], [np.nan, 2, 3, 2], [np.nan, 2, 3, 0]])) - - -def test_simple_imputer_deprecation_warning(): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - SimpleImputer(impute_strategy='mean') - assert len(w) == 1 - assert issubclass(w[-1].category, DeprecationWarning) - assert "deprecated" in str(w[-1].message)