facebookresearch / Kats

Kats, a kit to analyze time series data, a lightweight, easy-to-use, generalizable, and extendable framework to perform time series analysis, from understanding the key statistics and characteristics, detecting change points and anomalies, to forecasting future trends.
MIT License
4.88k stars 534 forks source link

Frequency error when using holtwinters with alpha. #241

Closed LumingSun closed 2 years ago

LumingSun commented 2 years ago

I'm using holtwinters model for hourly data. Everything is OK with fcst = m.predict(steps=24,freq="h",include_history=False) and the result is hourly-distributed.

But if I add the alpha parameter to get forecasting bound fcst = m.predict(steps=24,freq="h",alpha=alpha,include_history=False), the forecasting results become 24 daily data with the same hour value as the last timestamp in history data.

neelabalan commented 2 years ago

I could see default argument for frequency is "D"

https://github.com/facebookresearch/Kats/blob/622dca5a661ba5e1815e0414a2365cfe1f1736d4/kats/utils/emp_confidence_int.py#L171

In the case when alpha is passed as an argument forecast is obtained from get_eci function where only steps is passed. Additionally freq also need to be passed.

https://github.com/facebookresearch/Kats/blob/622dca5a661ba5e1815e0414a2365cfe1f1736d4/kats/models/holtwinters.py#L203