From c83da6fed1ce9ecda22ed821cdb4b158c7622a81 Mon Sep 17 00:00:00 2001 From: christopherbunn Date: Wed, 27 Dec 2023 14:28:59 -0500 Subject: [PATCH 1/4] Inital commit --- .../transformers/preprocessing/stl_decomposer.py | 1 + evalml/pipelines/time_series_regression_pipeline.py | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py b/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py index 2646db9904..76b8f4f3c4 100644 --- a/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py +++ b/evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py @@ -340,6 +340,7 @@ def transform( # Convert the list to a DataFrame # For multiseries, return tuple[pd.DataFrame, pd.Dataframe] where each column is a series_id detrending_df = pd.DataFrame(detrending_list).T + detrending_df.columns = y.columns return X, detrending_df def inverse_transform( diff --git a/evalml/pipelines/time_series_regression_pipeline.py b/evalml/pipelines/time_series_regression_pipeline.py index 92d0fda813..60a5e61cc6 100644 --- a/evalml/pipelines/time_series_regression_pipeline.py +++ b/evalml/pipelines/time_series_regression_pipeline.py @@ -226,7 +226,6 @@ def _get_series_intervals(intervals, residuals, trend_pred_intervals, y): if self.problem_type == ProblemTypes.MULTISERIES_TIME_SERIES_REGRESSION: from evalml.pipelines.utils import ( - MULTISERIES_SEPARATOR_SYMBOL, stack_data, unstack_multiseries, ) @@ -271,11 +270,7 @@ def _get_series_intervals(intervals, residuals, trend_pred_intervals, y): # `pred_intervals` are in {series_id: {coverage_label: bound_value}} form for series_id, series_intervals in pred_intervals.items(): - series_id_target_name = ( - self.input_target_name - + MULTISERIES_SEPARATOR_SYMBOL - + str(series_id) - ) + series_id_target_name = str(series_id) series_id_prediction_intervals = _get_series_intervals( series_intervals, residuals[series_id], From 6cefddf89c9d87d00d8bd8022df18c541d68a390 Mon Sep 17 00:00:00 2001 From: christopherbunn Date: Tue, 9 Jan 2024 14:29:03 -0500 Subject: [PATCH 2/4] Updated test --- .../test_multiseries_regression_pipeline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py b/evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py index f092da76a7..e777c5391b 100644 --- a/evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py +++ b/evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py @@ -347,7 +347,7 @@ def test_time_series_pipeline_get_prediction_intervals( ) X_train, y_train = X[:65], y[:65] X_validation, y_validation = X[65:], y[65:] - mock_X, _ = unstack_multiseries( + mock_X, mock_y = unstack_multiseries( X_train, y_train, series_id="series_id", @@ -356,7 +356,7 @@ def test_time_series_pipeline_get_prediction_intervals( ) mock_transform_return_value = ( mock_X, - pd.DataFrame(np.random.rand(13, 5)), + mock_y, ) with patch( "evalml.pipelines.components.transformers.preprocessing.stl_decomposer.STLDecomposer.transform", From 4dd9c440c02ebccd0958491de7266d8c0fdae9d5 Mon Sep 17 00:00:00 2001 From: christopherbunn Date: Tue, 9 Jan 2024 14:44:55 -0500 Subject: [PATCH 3/4] Update release notes --- docs/source/release_notes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index ed57e0877a..683001cf94 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -4,6 +4,7 @@ Release Notes * Enhancements * Fixes * Fixed bug in `_downcast_nullable_y` causing woodwork initialization issues :pr:`4369` + * Fixed multiseries prediction interval labels :pr:`4377` * Changes * Documentation Changes * Testing Changes From d45e07a159dbd9edc4d2ca42038c782c02ce52ba Mon Sep 17 00:00:00 2001 From: christopherbunn Date: Tue, 23 Jan 2024 13:45:05 -0500 Subject: [PATCH 4/4] Added coverage for column labels --- .../decomposer_tests/test_stl_decomposer.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py b/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py index 6e17067d59..b102dceb66 100644 --- a/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py +++ b/evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py @@ -148,8 +148,15 @@ def test_stl_fit_transform_in_sample( stl = STLDecomposer(period=period) + series_id_columns = ["series_1", "series_2"] + if variateness == "multivariate": + y.columns = series_id_columns + X_t, y_t = stl.fit_transform(X, y) + if variateness == "multivariate": + assert all(y_t.columns == series_id_columns) + # If y_t is a pd.Series, give it columns if isinstance(y_t, pd.Series): y_t = y_t.to_frame() @@ -179,7 +186,11 @@ def test_stl_fit_transform_in_sample( # Check the trend to make sure STL worked properly pd.testing.assert_series_equal( pd.Series(expected_trend), - pd.Series(stl.trends[0]), + pd.Series( + stl.trends["series_1"] + if variateness == "multivariate" + else stl.trends[0], + ), check_exact=False, check_index=False, check_names=False,