Ken Lee
08/23/2024, 7:23 PMMariana Menchero
08/23/2024, 8:44 PMKen Lee
08/23/2024, 9:03 PMMSTL MSTL-lo-95 MSTL-lo-80 MSTL-hi-80 MSTL-hi-95
Mariana Menchero
08/23/2024, 9:11 PMKen Lee
08/23/2024, 9:11 PMKen Lee
08/23/2024, 9:12 PMMariana Menchero
08/23/2024, 9:13 PMimport os
from statsforecast import StatsForecast
from statsforecast.models import MSTL
from statsforecast.utils import AirPassengersDF as ap
os.environ['NIXTLA_ID_AS_COL'] = '1'
sf = StatsForecast(
models=[MSTL(season_length=[12])],
freq = 'MS'
)
fc = sf.forecast(df=ap, h=12, level=[80,95])
StatsForecast.plot(ap, fc, level=[80,95])
Mariana Menchero
08/23/2024, 9:13 PMKen Lee
08/23/2024, 9:14 PMMariana Menchero
08/23/2024, 11:01 PMseasonal_length
is set to an absurd number (8766). With the correct value (24*7), the prediction intervals look ok. It should be in main by Monday 🙂Ken Lee
08/23/2024, 11:10 PMKen Lee
08/23/2024, 11:23 PMimport os
from statsforecast import StatsForecast
from statsforecast.models import MSTL
from statsforecast.utils import AirPassengersDF as ap
import numpy as np
os.environ['NIXTLA_ID_AS_COL'] = '1'
evaluation = []
grid = np.arange(10, ap.shape[0], 10)
for g in grid:
sf = StatsForecast(
models=[MSTL(season_length=[g])],
freq = 'MS'
)
fc = sf.forecast(df=ap, h=12, level=[80,95], id_col="unique_id")
evaluation.append((g, np.mean(fc["MSTL-hi-95"] - fc["MSTL"])))
pd.DataFrame(evaluation, columns = ["seasonal_length", "distance"]).plot.scatter(x="seasonal_length", y="distance", title="seasonal length vs. confidence interval distance")
Mariana Menchero
08/24/2024, 12:46 AMKen Lee
08/24/2024, 4:23 AM[24, 24 * 7, 24 * 7 *30]
. this is not too wild right, now.... you train a model but for some time series, you only have 30 days worth of data.... then you hit this diminishing CI bug.... where your 24 * 7 * 30 completely makes your CI went away.
The user has no way to know why this is not working, this model worked on time series with a year worth of data, but all of a sudden the CI shrink for a shorter time frame... 🧩Valeriy
08/30/2024, 10:07 AM