From 24ba211b7a0cf461166f2b7670f2c891316007c0 Mon Sep 17 00:00:00 2001 From: Becca McBrayer Date: Fri, 18 Aug 2023 15:40:28 -0400 Subject: [PATCH] Make prediction intervals name more robust for sktime (#4283) * Make pred intervals name more robust --- docs/source/release_notes.rst | 1 + .../components/estimators/regressors/arima_regressor.py | 5 +++-- evalml/tests/component_tests/test_arima_regressor.py | 4 +++- .../dependency_update_check/latest_dependency_versions.txt | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index c5e524cb93..68e55f261d 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -4,6 +4,7 @@ Release Notes * Enhancements * Fixes * Changes + * Updated ``ARIMARegressor`` to be compatible with sktime v0.22.0 and beyond :pr:`4283` * Documentation Changes * Removed erroneous warnings from Data Checks User Guide page and removed ``tqdm`` warning in all notebooks :pr:`4274` * Testing Changes diff --git a/evalml/pipelines/components/estimators/regressors/arima_regressor.py b/evalml/pipelines/components/estimators/regressors/arima_regressor.py index e1e4dc1b7c..dc1e54f9c9 100644 --- a/evalml/pipelines/components/estimators/regressors/arima_regressor.py +++ b/evalml/pipelines/components/estimators/regressors/arima_regressor.py @@ -229,8 +229,9 @@ def _parse_prediction_intervals( y_pred_intervals: pd.DataFrame, conf_int: float, ) -> Tuple[pd.Series, pd.Series]: - preds_lower = y_pred_intervals.loc(axis=1)[("Coverage", conf_int, "lower")] - preds_upper = y_pred_intervals.loc(axis=1)[("Coverage", conf_int, "upper")] + coverage_name = y_pred_intervals.columns[0][0] + preds_lower = y_pred_intervals.loc(axis=1)[(coverage_name, conf_int, "lower")] + preds_upper = y_pred_intervals.loc(axis=1)[(coverage_name, conf_int, "upper")] preds_lower.name = None preds_upper.name = None return preds_lower, preds_upper diff --git a/evalml/tests/component_tests/test_arima_regressor.py b/evalml/tests/component_tests/test_arima_regressor.py index 549b962259..1d816751de 100644 --- a/evalml/tests/component_tests/test_arima_regressor.py +++ b/evalml/tests/component_tests/test_arima_regressor.py @@ -391,8 +391,10 @@ def test_arima_regressor_respects_use_covariates(mock_predict, mock_fit, ts_data @pytest.mark.parametrize("no_features", [True, False]) -def test_arima_regressor_prediction_intervals(no_features, ts_data): +@pytest.mark.parametrize("y_name", [None, "y"]) +def test_arima_regressor_prediction_intervals(no_features, ts_data, y_name): X_train, X_test, y_train = ts_data(no_features=no_features) + y_train.name = y_name clf = ARIMARegressor(use_covariates=not no_features) diff --git a/evalml/tests/dependency_update_check/latest_dependency_versions.txt b/evalml/tests/dependency_update_check/latest_dependency_versions.txt index ad44847050..dc2c54e5cd 100644 --- a/evalml/tests/dependency_update_check/latest_dependency_versions.txt +++ b/evalml/tests/dependency_update_check/latest_dependency_versions.txt @@ -29,7 +29,7 @@ scikit-optimize==0.9.0 scipy==1.10.1 seaborn==0.12.2 shap==0.42.1 -sktime==0.21.1 +sktime==0.22.0 statsmodels==0.14.0 texttable==1.6.7 tomli==2.0.1