Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed multiseries prediction interval labels #4377

Merged
merged 5 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
* Pinned scipy version to under 1.12.0 :pr:`4380`
* Documentation Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
# 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

Check warning on line 343 in evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/stl_decomposer.py#L343

Added line #L343 was not covered by tests
return X, detrending_df

def inverse_transform(
Expand Down
7 changes: 1 addition & 6 deletions evalml/pipelines/time_series_regression_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@

if self.problem_type == ProblemTypes.MULTISERIES_TIME_SERIES_REGRESSION:
from evalml.pipelines.utils import (
MULTISERIES_SEPARATOR_SYMBOL,
stack_data,
unstack_multiseries,
)
Expand Down Expand Up @@ -271,11 +270,7 @@

# `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)

Check warning on line 273 in evalml/pipelines/time_series_regression_pipeline.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L273

Added line #L273 was not covered by tests
series_id_prediction_intervals = _get_series_intervals(
series_intervals,
residuals[series_id],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,15 @@

stl = STLDecomposer(period=period)

series_id_columns = ["series_1", "series_2"]
if variateness == "multivariate":
y.columns = series_id_columns

Check warning on line 153 in evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py#L151-L153

Added lines #L151 - L153 were not covered by tests

X_t, y_t = stl.fit_transform(X, y)

if variateness == "multivariate":
assert all(y_t.columns == series_id_columns)

Check warning on line 158 in evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/component_tests/decomposer_tests/test_stl_decomposer.py#L157-L158

Added lines #L157 - L158 were not covered by tests

# If y_t is a pd.Series, give it columns
if isinstance(y_t, pd.Series):
y_t = y_t.to_frame()
Expand Down Expand Up @@ -179,7 +186,11 @@
# 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
)
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(

Check warning on line 350 in evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/pipeline_tests/regression_pipeline_tests/test_multiseries_regression_pipeline.py#L350

Added line #L350 was not covered by tests
X_train,
y_train,
series_id="series_id",
Expand All @@ -356,7 +356,7 @@
)
mock_transform_return_value = (
mock_X,
pd.DataFrame(np.random.rand(13, 5)),
mock_y,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway we can add coverage here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe here?

)
with patch(
"evalml.pipelines.components.transformers.preprocessing.stl_decomposer.STLDecomposer.transform",
Expand Down
Loading