Nixtla / utilsforecast

https://nixtlaverse.nixtla.io/utilsforecast
Apache License 2.0
42 stars 6 forks source link

Impossible to plot Insample Anomalies without a `forecast_df` #97

Closed omriKramer closed 3 months ago

omriKramer commented 3 months ago

Right now it is Impossible to plot anomalies for insample data without passing a forecast_df even though it is a valid use case. Moreover, the prediction intervals for df are filtered out by df = _filter_series(...) at line 162 which prevents plotting the insample anomalies.

jmoralez commented 3 months ago

The following should work:

from utilsforecast.data import generate_series
from utilsforecast.plotting import plot_series

level = [95]
series = generate_series(2, n_models=1, level=level)
plot_series(series, series, level=level, plot_anomalies=True, max_insample_length=0)
omriKramer commented 3 months ago

You are right, didn't realize I can use max_insample_length thank you!

jmoralez commented 3 months ago

We can make the df optional and being able to provide just forecasts_df for this case to avoid having to repeat it

jmoralez commented 3 months ago

Fixed by #98