Skip to content

Commit

Permalink
Renamed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbunn committed Sep 29, 2023
1 parent a0c5304 commit 432d632
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions evalml/pipelines/time_series_regression_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,47 +251,57 @@ def _get_series_intervals(intervals, residuals, trend_pred_intervals, y):
residuals = self.estimator.predict(
estimator_input,
)
trans_pred_intervals = {}
transformed_pred_intervals = {}

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L254

Added line #L254 was not covered by tests
trend_pred_intervals = self.get_component(
"STL Decomposer",
).get_trend_prediction_intervals(y, coverage=coverage)

if is_multiseries(self.problem_type):

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L259

Added line #L259 was not covered by tests
intervals_labels = list(list(pred_intervals.values())[0].keys())
# Coverage label is label for each prediction interval limit(e.g. "0.95_lower")
coverage_labels = list(list(pred_intervals.values())[0].keys())

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L261

Added line #L261 was not covered by tests

# Store prediction interval data in {coverage_label: {series_id: bound_value}}
interval_series_pred_intervals = {

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L264

Added line #L264 was not covered by tests
interval: {} for interval in intervals_labels
coverage_label: {} for coverage_label in coverage_labels
}

# `pred_intervals` are in {series_id: {coverage_label: bound_value}} form
for series_id, series_intervals in pred_intervals.items():
series_id_target_name = (

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L269-L270

Added lines #L269 - L270 were not covered by tests
self.input_target_name + "_" + str(series_id)
)
series_id_interval_result = _get_series_intervals(
series_id_prediction_intervals = _get_series_intervals(

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_intervals,
residuals[series_id],
trend_pred_intervals[series_id_target_name],
y[series_id_target_name],
)
for interval, interval_data in series_id_interval_result.items():
interval_series_pred_intervals[interval][
# Store `series_id_prediction_intervals` data in `interval_series_pred_intervals` format
for (

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L280

Added line #L280 was not covered by tests
coverage_label,
bound_value,
) in series_id_prediction_intervals.items():
interval_series_pred_intervals[coverage_label][

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L284

Added line #L284 was not covered by tests
series_id_target_name
] = interval_data
for interval in intervals_labels:
series_id_df = pd.DataFrame(
interval_series_pred_intervals[interval],
] = bound_value
# Stack bound data for each coverage label so each bound has a single pd.Series
for coverage_label in coverage_labels:
series_id_interval_df = pd.DataFrame(

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L288-L289

Added lines #L288 - L289 were not covered by tests
interval_series_pred_intervals[coverage_label],
)
stacked_pred_interval = stack_data(

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L292

Added line #L292 was not covered by tests
data=series_id_df,
data=series_id_interval_df,
series_id_name=self.series_id,
)
trans_pred_intervals[interval] = stacked_pred_interval
transformed_pred_intervals[coverage_label] = stacked_pred_interval

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L296

Added line #L296 was not covered by tests
else:
trans_pred_intervals = _get_series_intervals(
transformed_pred_intervals = _get_series_intervals(

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L298

Added line #L298 was not covered by tests
pred_intervals,
residuals,
trend_pred_intervals,
y,
)
return trans_pred_intervals
return transformed_pred_intervals

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

View check run for this annotation

Codecov / codecov/patch

evalml/pipelines/time_series_regression_pipeline.py#L304

Added line #L304 was not covered by tests
else:
future_vals = self.predict(
X=X,
Expand Down

0 comments on commit 432d632

Please sign in to comment.