user@devops:~$ cat README.md
N-BEATS + N-HiTS -- neural forecasting vs classical
# Description
NeuralForecast (Nixtla) architectures implemented from scratch in PyTorch, without the neuralforecast library. Part 1: synthetic panel 8 stores x 420 days with trend, weekly seasonality, 90-day cycle and promo spikes (y mean 65.6). Train/val/test split with lookback 42 and horizon 14 (904 train windows, seed 42). Part 2: classical baselines -- SeasonalNaive MAE 3.058, Holt-Winters 3.073, Ridge lags+Fourier 2.518. Part 3: generic N-BEATS with 3 residual backcast/forecast blocks, 69,096 params, val MAE 2.668, holdout MAE 2.833. Part 4: N-HiTS downsample 8/4/1 with linear interpolation, 21,195 params, val MAE 2.518, holdout MAE 2.790. Part 5: interpretable N-BEATS (degree-3 polynomial + period-7 Fourier + remainder) 46,736 params, val MAE 2.202. Part 6: one-shot holdout H=14 and 4-origin rolling -- winner N-BEATS-I MAE 2.446 / rolling 2.476 (MASE 0.795, -20% vs SeasonalNaive). Finding: on short series with clear seasonality the inductive bias (trend+Fourier) beats the generic block; Ridge with the same bases is a serious rival; N-HiTS nearly matches generic N-BEATS with 3x fewer parameters. CPU training 4.3s + 3.1s + 3.3s. 7 visualizations.
# Key features
$ Synthetic panel 8 stores x 420 days: trend, weekly season, 90d cycle and promos
$ Baselines: SeasonalNaive, additive Holt-Winters, Ridge lags 42 + Fourier
$ Generic N-BEATS (Oreshkin 2019): 3 residual blocks, 69,096 params, MAE 2.833
$ N-HiTS (Challu 2022): multi-rate interpolation ds=8/4/1, 21,195 params, MAE 2.790
$ Interpretable N-BEATS: polynomial + Fourier + remainder, MAE 2.446 (-20% vs naive)
$ Holdout H=14 + 4-origin rolling; winner MASE 0.795
$ Ridge lags+Fourier MAE 2.518: strong linear baseline when seasonality is clear
$ 7 visualizations: overview, seasonality, forecasts, metrics, stacks, horizon, N-HiTS
# Gallery
# Technologies used