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

Add catch for invalid time index frequencies #3800

Merged
merged 5 commits into from
Nov 2, 2022
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.
Jump to
Jump to file
Failed to load files.
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 @@ -6,6 +6,7 @@ Release Notes
* Fixes
* Fixed bug with datetime conversion in ``get_time_index`` :pr:`3792`
* Fixed bug where invalid anchored or offset frequencies were including the ``STLDecomposer`` in pipelines :pr:`3794`
* Fixed bug where irregular datetime frequencies were causing errors in ``make_pipeline`` :pr:`3800`
* Changes
* Capped dask at < 2022.10.1 :pr:`3797`
* Uncapped dask and excluded 2022.10.1 from viable versions :pr:`3803`
Expand Down
3 changes: 3 additions & 0 deletions evalml/pipelines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def _get_decomposer(X, y, problem_type, estimator_class, sampler_name=None):
components = []
if is_time_series(problem_type) and is_regression(problem_type):
time_index = get_time_index(X, y, None)
# If the time index frequency is uninferrable, STL will fail
if time_index.freq is None:
return components
freq = time_index.freq.name.split("-")[0]
if (
freq[-1] not in _UNSUPPORTED_FREQUENCIES_STL_DECOMPOSER
Expand Down
12 changes: 11 additions & 1 deletion evalml/tests/pipeline_tests/test_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def test_make_pipeline(
("10T", False),
("AS-JAN", False),
("YS", False),
(None, False),
],
)
def test_make_pipeline_controls_decomposer_time_series(
Expand All @@ -219,7 +220,16 @@ def test_make_pipeline_controls_decomposer_time_series(
problem_type,
column_names=["dates", "numerical"],
)
X.ww["dates"] = pd.Series(pd.date_range("2000-02-03", periods=20, freq=frequency))
if frequency is None:
X.ww["dates"] = pd.Series(
pd.date_range("2000-02-03", periods=10, freq=frequency).append(
pd.date_range("2000-02-15", periods=10, freq=frequency),
),
)
else:
X.ww["dates"] = pd.Series(
pd.date_range("2000-02-03", periods=20, freq=frequency),
)
parameters = {
"pipeline": {
"time_index": "date",
Expand Down