Skip to content

Commit

Permalink
Move predict code
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbunn committed Sep 27, 2023
1 parent 4135939 commit 41c3944
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions evalml/pipelines/time_series_regression_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,31 +205,31 @@ def get_prediction_intervals(
Raises:
MethodPropertyNotFoundError: If the estimator does not support Time Series Regression as a problem type.
"""
X_no_datetime, y_no_datetime = self._drop_time_index(X, y)
if self.problem_type == ProblemTypes.MULTISERIES_TIME_SERIES_REGRESSION:
from evalml.pipelines.utils import unstack_multiseries

X_no_datetime, y_no_datetime = unstack_multiseries(
X_train,
y_train,
self.series_id,
self.time_index,
self.input_target_name,
)

estimator_input = self.transform_all_but_final(
X_no_datetime,
y_no_datetime,
X_train=X_train,
y_train=y_train,
)
has_stl = STLDecomposer.name in list(
self.component_graph.component_instances.keys(),
)
if coverage is None:
coverage = [0.95]

if self.estimator.model_family in self.NO_PREDS_PI_ESTIMATORS and has_stl:
X_no_datetime, y_no_datetime = self._drop_time_index(X, y)
if self.problem_type == ProblemTypes.MULTISERIES_TIME_SERIES_REGRESSION:
from evalml.pipelines.utils import unstack_multiseries

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L217

Added line #L217 was not covered by tests

X_no_datetime, y_no_datetime = unstack_multiseries(

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L219

Added line #L219 was not covered by tests
X_train,
y_train,
self.series_id,
self.time_index,
self.input_target_name,
)

estimator_input = self.transform_all_but_final(
X_no_datetime,
y_no_datetime,
X_train=X_train,
y_train=y_train,
)
pred_intervals = self.estimator.get_prediction_intervals(
X=estimator_input,
y=y,
Expand All @@ -251,6 +251,7 @@ def get_prediction_intervals(
)
return trans_pred_intervals
else:
print(X)
future_vals = self.predict(
X=X,
X_train=X_train,
Expand Down

0 comments on commit 41c3944

Please sign in to comment.