Skip to content

Commit

Permalink
Merge branch 'master' into tbas_adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
scanhex12 authored Jun 3, 2022
2 parents ae8b9d3 + d85c7f0 commit 698c22c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
26 changes: 13 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
### Fixed
-
-
-
-
-
-
- Fix bug when `ts.plot` does not save figure ([#714](https://github.com/tinkoff-ai/etna/pull/714))
-
-
- Fix bug in plot_clusters ([#675](https://github.com/tinkoff-ai/etna/pull/675))
-
-
- Fix bugs and documentation for cross_corr_plot ([#691](https://github.com/tinkoff-ai/etna/pull/691))
-
-
-
-
- Fix bugs and documentation for plot_backtest and plot_backtest_interactive ([#700](https://github.com/tinkoff-ai/etna/pull/700))
-
-
-
-
-
-
-
-
- Fix tiny prediction intervals ([#722](https://github.com/tinkoff-ai/etna/pull/722))
-
-
-

## [1.9.0] - 2022-05-17
### Added
Expand Down
2 changes: 0 additions & 2 deletions etna/datasets/tsdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ def plot(
ax[i].set_title(segment)
ax[i].grid()

plt.show()

@staticmethod
def to_flatten(df: pd.DataFrame) -> pd.DataFrame:
"""Return pandas DataFrame with flatten index.
Expand Down
5 changes: 2 additions & 3 deletions etna/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import numpy as np
import pandas as pd
import scipy
from joblib import Parallel
from joblib import delayed
from scipy.stats import norm
Expand Down Expand Up @@ -231,11 +230,11 @@ def _forecast_prediction_interval(
- self.ts[forecasts.index.min() : forecasts.index.max(), :, "target"]
)

se = scipy.stats.sem(residuals)
sigma = np.std(residuals.values, axis=0)
borders = []
for quantile in quantiles:
z_q = norm.ppf(q=quantile)
border = predictions[:, :, "target"] + se * z_q
border = predictions[:, :, "target"] + sigma * z_q
border.rename({"target": f"target_{quantile:.4g}"}, inplace=True, axis=1)
borders.append(border)

Expand Down
10 changes: 5 additions & 5 deletions tests/test_pipeline/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Tuple

import numpy as np
import pandas as pd
import pytest
import scipy
from numpy.random import RandomState
from scipy.stats import norm

Expand Down Expand Up @@ -68,10 +68,10 @@ def splited_piecewise_constant_ts(
segment_2 = [constant_2_1] * first_constant_len + [constant_2_2] * horizon * 2

quantile = norm.ppf(q=(1 + INTERVAL_WIDTH) / 2)
se_1 = scipy.stats.sem([0.0] * horizon * 2 + [constant_1_1 - constant_1_2] * horizon)
se_2 = scipy.stats.sem([0.0] * horizon * 2 + [constant_2_1 - constant_2_2] * horizon)
lower = [x - se_1 * quantile for x in segment_1] + [x - se_2 * quantile for x in segment_2]
upper = [x + se_1 * quantile for x in segment_1] + [x + se_2 * quantile for x in segment_2]
sigma_1 = np.std([0.0] * horizon * 2 + [constant_1_1 - constant_1_2] * horizon)
sigma_2 = np.std([0.0] * horizon * 2 + [constant_2_1 - constant_2_2] * horizon)
lower = [x - sigma_1 * quantile for x in segment_1] + [x - sigma_2 * quantile for x in segment_2]
upper = [x + sigma_1 * quantile for x in segment_1] + [x + sigma_2 * quantile for x in segment_2]

ts_range = list(pd.date_range("2020-01-03", freq="1D", periods=len(segment_1)))
lower_p = (1 - INTERVAL_WIDTH) / 2
Expand Down

0 comments on commit 698c22c

Please sign in to comment.