Skip to content

[BUG] etna.analysis.backtest does't visualize the forecast for a horizon equal to one #1122

Closed
1 task done
nikolskydn opened this issue Feb 21, 2023 · 0 comments · Fixed by #1260
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@nikolskydn
Copy link

🐛 Bug Report

The etna.analysis.backtest does't visualize the forecast for a horizon equal to one.

Expected behavior

For a horizon equal to one, a marker (from the label) should be displayed.

How To Reproduce

import numpy as np
import pandas as pd
from etna.datasets import TSDataset
from etna.transforms import SegmentEncoderTransform
from etna.pipeline import Pipeline
from etna.models import LinearPerSegmentModel
from etna.metrics import SMAPE
from etna.analysis import plot_backtest


freq = 'M'
idx = pd.to_datetime(pd.date_range(start='2022-06-01', end='2023-01-01', freq=freq))
df0 = pd.DataFrame({
    'timestamp': idx,
    'segment': ['user_0']*idx.size,
    'target': np.linspace(1, 21, num=idx.size)
})
df = TSDataset.to_dataset(df0)
ts = TSDataset(df=df, freq=freq)
model = LinearPerSegmentModel()
pipe = Pipeline(model=model, transforms=[SegmentEncoderTransform()], horizon=1)
metrics, forecast, info = pipe.backtest(ts=ts, metrics=[SMAPE()], n_folds=1)
plot_backtest(forecast_df=forecast, ts=ts, history_len=3)

image

Environment

print(platform.platform())
print(platform.python_version())

Linux-5.19.0-32-generic-x86_64-with-glibc2.35

3.10.6

! pip3 list | grep etna

etna 1.15.0

Additional context

The forecast is displayed if add a marker in the operators plot() from the function plotters.plot_backtest (when horizon=1).

Checklist

  • Bug appears at the latest library version
@nikolskydn nikolskydn added the bug Something isn't working label Feb 21, 2023
@Mr-Geekman Mr-Geekman changed the title [BUG] [BUG] etna.analysis.backtest does't visualize the forecast for a horizon equal to one Apr 28, 2023
@Mr-Geekman Mr-Geekman self-assigned this May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants