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

Extend STLDecomposer to Support Multiseries #4253

Merged
merged 57 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
929ac9b
initial commit
remyogasawara Jul 20, 2023
fedca59
creates multiple graphs
remyogasawara Jul 21, 2023
a0e4a39
able to graph decomp
remyogasawara Jul 21, 2023
88f7d67
graph individually
remyogasawara Jul 24, 2023
9f4a0d5
clean up
remyogasawara Jul 25, 2023
9f82dd3
set period and freq
remyogasawara Jul 25, 2023
7d1a204
modify transformer and groups
remyogasawara Jul 26, 2023
d87f007
use dictionary instead of list
remyogasawara Jul 27, 2023
c43b860
pass components test and fix ww
remyogasawara Jul 28, 2023
3025b20
check if multiseris variable
remyogasawara Jul 29, 2023
c7f1edd
extend stldecomposer for multiseries
remyogasawara Jul 31, 2023
be2dd2d
add null checks
remyogasawara Jul 31, 2023
c2b60ac
Add stacking and unstacking utils for multiseries (#4250)
eccabay Jul 26, 2023
781c139
Add support for pandas 2 (#4216)
christopherbunn Jul 27, 2023
4a8cc0f
reset condition for period
remyogasawara Jul 31, 2023
68566b6
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 2, 2023
a8c2445
take dataframe as y input and fix indexing
remyogasawara Aug 3, 2023
13c5d29
fix lint
remyogasawara Aug 3, 2023
354c95a
formatting
remyogasawara Aug 3, 2023
a506101
remove print statement
remyogasawara Aug 3, 2023
5745a10
pd 2 support
remyogasawara Aug 3, 2023
3363e10
update inverse_transform and get_trend_dataframe
remyogasawara Aug 7, 2023
1768261
update get_trend_prediction_intervals and add multiseries tests
remyogasawara Aug 7, 2023
e329195
update index in plotting instead
remyogasawara Aug 8, 2023
61d1a18
add ms seasonal data
remyogasawara Aug 8, 2023
d3c9468
subset test remaining
remyogasawara Aug 11, 2023
58cd094
add multiseries tests
remyogasawara Aug 14, 2023
b68fda8
fix univariate tests
remyogasawara Aug 14, 2023
150cfd5
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 14, 2023
95d2619
fix codecov
remyogasawara Aug 14, 2023
0370ecb
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 14, 2023
55b5f1d
add plot test
remyogasawara Aug 14, 2023
5a131a3
check STL is detrended/deseasoned
remyogasawara Aug 14, 2023
588ec95
get rid of class vars
remyogasawara Aug 16, 2023
6819ca1
change parent function instead of overload
remyogasawara Aug 16, 2023
1083245
ability to transform on new data
remyogasawara Aug 16, 2023
b28ff90
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 16, 2023
998d964
get rid of step param
remyogasawara Aug 17, 2023
2f32f5b
fix data types and duplicate lines
remyogasawara Aug 18, 2023
e889dcb
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 18, 2023
02733c3
remove stuff from loops
remyogasawara Aug 18, 2023
70e34c8
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 18, 2023
09e31f2
condense code
remyogasawara Aug 22, 2023
837fc79
periods parameters
remyogasawara Aug 22, 2023
8e379c1
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 22, 2023
3677345
add unstacking
remyogasawara Aug 22, 2023
fd99c53
fix import
remyogasawara Aug 22, 2023
dd7b74f
add unstacking and test
remyogasawara Aug 22, 2023
d8e23e0
remove comments
remyogasawara Aug 22, 2023
ecbfe86
update periods and tests
remyogasawara Aug 25, 2023
eb961d6
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 25, 2023
cee84ea
set y index
remyogasawara Aug 25, 2023
aa5a95a
simplify get_trend_dataframe
remyogasawara Aug 25, 2023
730f409
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 29, 2023
b9e9d45
change type to dict(list(df))
remyogasawara Aug 30, 2023
28de27f
Merge branch 'main' into 4244_extend_stldecomp_for_multiseries
remyogasawara Aug 31, 2023
3cc6cf3
update notes
remyogasawara Aug 31, 2023
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 @@ -2,6 +2,7 @@ Release Notes
-------------
**Future Releases**
* Enhancements
* Extended STLDecomposer to Support Multiseries :pr:`4253`
* Fixes
* Changes
* Documentation Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
def plot_decomposition(
self,
X: pd.DataFrame,
y: pd.Series,
y: pd.DataFrame,
remyogasawara marked this conversation as resolved.
Show resolved Hide resolved
show: bool = False,
) -> tuple[plt.Figure, list]:
"""Plots the decomposition of the target signal.
Expand All @@ -340,20 +340,46 @@
plotted on them

"""
if isinstance(y, pd.Series):
y = y.to_frame()

Check warning on line 344 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L343-L344

Added lines #L343 - L344 were not covered by tests

plot_info = {}
if self.frequency and self.time_index and len(y.columns) > 1:
X.index = pd.DatetimeIndex(X[self.time_index], freq=self.frequency)

Check warning on line 348 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L346-L348

Added lines #L346 - L348 were not covered by tests
decomposition_results = self.get_trend_dataframe(X, y)
fig, axs = plt.subplots(4)
fig.set_size_inches(18.5, 14.5)
axs[0].plot(decomposition_results[0]["signal"], "r")
axs[0].set_title("signal")
axs[1].plot(decomposition_results[0]["trend"], "b")
axs[1].set_title("trend")
axs[2].plot(decomposition_results[0]["seasonality"], "g")
axs[2].set_title("seasonality")
axs[3].plot(decomposition_results[0]["residual"], "y")
axs[3].set_title("residual")
if show: # pragma: no cover
plt.show()
return fig, axs

# Iterate through each series id
for id in y.columns:
fig, axs = plt.subplots(4)
fig.set_size_inches(18.5, 14.5)

Check warning on line 354 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L352-L354

Added lines #L352 - L354 were not covered by tests

for ax in axs:
ax.cla()

Check warning on line 357 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L356-L357

Added lines #L356 - L357 were not covered by tests
remyogasawara marked this conversation as resolved.
Show resolved Hide resolved

if len(y.columns) > 1:
results = decomposition_results[id]

Check warning on line 360 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L359-L360

Added lines #L359 - L360 were not covered by tests
else:
results = decomposition_results
axs[0].plot(results[0]["signal"], "r")
axs[0].set_title("signal")
axs[1].plot(results[0]["trend"], "b")
axs[1].set_title("trend")
axs[2].plot(results[0]["seasonality"], "g")
axs[2].set_title("seasonality")
axs[3].plot(results[0]["residual"], "y")
axs[3].set_title("residual")

Check warning on line 370 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L362-L370

Added lines #L362 - L370 were not covered by tests

# If multiseries, return a dictionary of tuples
if len(y.columns) > 1:
fig.suptitle("Decomposition for Series {}".format(id))
remyogasawara marked this conversation as resolved.
Show resolved Hide resolved
plot_info[id] = (fig, axs)

Check warning on line 375 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L373-L375

Added lines #L373 - L375 were not covered by tests
else:
plot_info = (fig, axs)

Check warning on line 377 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L377

Added line #L377 was not covered by tests

if show: # pragma: no cover
plt.show()

return plot_info

Check warning on line 382 in evalml/pipelines/components/transformers/preprocessing/decomposer.py

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/components/transformers/preprocessing/decomposer.py#L382

Added line #L382 was not covered by tests

def _check_target(self, X: pd.DataFrame, y: pd.Series):
"""Function to ensure target is not None and has a pandas.DatetimeIndex."""
Expand Down
Loading
Loading