Skip to content

Commit

Permalink
refactor: replace selt.ts with ts, remove redundant checks of self.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
d.a.bunin committed Mar 23, 2023
1 parent 2f6b0a1 commit 60b68b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions etna/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@ def _add_forecast_borders(
self, ts: TSDataset, backtest_forecasts: pd.DataFrame, quantiles: Sequence[float], predictions: TSDataset
) -> None:
"""Estimate prediction intervals and add to the forecasts."""
if self.ts is None:
raise ValueError("Pipeline is not fitted!")

backtest_forecasts = TSDataset(df=backtest_forecasts, freq=self.ts.freq)
backtest_forecasts = TSDataset(df=backtest_forecasts, freq=ts.freq)
residuals = (
backtest_forecasts.loc[:, pd.IndexSlice[:, "target"]]
- ts[backtest_forecasts.index.min() : backtest_forecasts.index.max(), :, "target"]
Expand Down
2 changes: 1 addition & 1 deletion etna/pipeline/hierarchical_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def raw_forecast(
freq=forecast.freq,
df_exog=forecast.df_exog,
known_future=forecast.known_future,
hierarchical_structure=self.ts.hierarchical_structure, # type: ignore
hierarchical_structure=ts.hierarchical_structure, # type: ignore
)
return hierarchical_forecast

Expand Down
4 changes: 2 additions & 2 deletions tests/test_pipeline/test_hierarchical_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pathlib
from copy import deepcopy
from unittest.mock import Mock
from unittest.mock import patch

Expand All @@ -23,7 +22,8 @@
from etna.transforms import LinearTrendTransform
from etna.transforms import MeanTransform
from tests.test_pipeline.utils import assert_pipeline_equals_loaded_original
from tests.test_pipeline.utils import assert_pipeline_forecasts_given_ts_with_prediction_intervals, assert_pipeline_forecasts_given_ts
from tests.test_pipeline.utils import assert_pipeline_forecasts_given_ts
from tests.test_pipeline.utils import assert_pipeline_forecasts_given_ts_with_prediction_intervals
from tests.utils import to_be_fixed


Expand Down

0 comments on commit 60b68b8

Please sign in to comment.