Artificial Intelligence Applications in Engineering (MUH-920), week 12 of 14: interactive lab

Forecast workbench: Baselines, smoothing and honest evaluation

Prof. Dr. Utku Kose, Süleyman Demirel University

Part A computes autocorrelations and differences, and Part B baselines with four error measures [1, 2]. Part C generates a monthly series with adjustable trend, seasonal amplitude, noise and an optional level shift, and compares naive, seasonal naive, moving average, trend-and-season regression and Holt-Winters exponential smoothing on a held-out final period [2]. Part D repeats the comparison over rolling origins and shows how the error grows with the horizon. Part E fits autoregressions by least squares and forecasts recursively, Part F runs exponential smoothing and Holt's method step by step, Part G unrolls a recurrent unit and an LSTM cell over a sequence [3, 4], and Part H turns forecasts into intervals, quantiles and cost-optimal decisions [5].

Part A: Autocorrelation and differences

The quarterly demand of the worked example is the default. The panel computes the mean, the sum of squared deviations and, for a chosen lag, every product of the numerator; the chart shows all autocorrelations with the band ±1.96/√T, and the first and seasonal differences appear below [1, 2].

Part B: Baselines and four error measures

The last values of the series form the test period. Five baselines forecast it: naive, seasonal naive, seasonal naive with the mean yearly change of the training data, the drift method and the training mean. The table compares MAE, RMSE, MAPE and MASE, and the panel writes out the arithmetic for one method [2].

Part C: One origin, five methods

Part D: Rolling origins

Twelve origins, each followed by a 12-month horizon. The chart shows the mean absolute error for every horizon step and method.

Part E: Autoregression by least squares

An autoregression of order 1 is fitted with the sums of the worked example, or one of order 2 through the normal equations. The panel lists every recursive forecast with its terms, and the chart shows the fitted values and the forecasts approaching the mean [1].

Part F: Exponential smoothing step by step

Simple exponential smoothing or Holt's method runs through any series. The table gives the one-step forecast, the error, the new level and the new trend of every step, and the panel the forecasts and the sum of squared one-step errors, which a good choice of α and β makes small [2].

Part G: A recurrent unit and an LSTM cell over a sequence

The first panel unrolls a simple recurrent unit and multiplies the derivatives from step to step, which shows the vanishing or exploding gradient. The second runs an LSTM cell, by default for the one step of the worked example; a longer input sequence shows how the cell state carries information while the forget gates stay close to 1 [3, 4, 6].

A simple recurrent unit

An LSTM cell

Part H: Intervals, quantiles and decisions

The first panel widens a prediction interval with the square root of the horizon, the second scores quantile forecasts with the pinball loss, and the third finds the planned value that minimises the expected cost of shortfalls and surpluses for a normal forecast distribution [2, 5].

Intervals that widen with the horizon

Pinball loss of quantile forecasts

The quantile that minimises the expected cost

References

[1] Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time Series Analysis: Forecasting and Control (5th ed.). Wiley.

[2] Hyndman, R. J., & Athanasopoulos, G. (2021). Forecasting: Principles and Practice (3rd ed.). OTexts. https://otexts.com/fpp3/

[3] Elman, J. L. (1990). Finding structure in time. Cognitive Science, 14(2), 179-211. https://doi.org/10.1207/s15516709cog1402_1

[4] Hochreiter, S., & Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735-1780. https://doi.org/10.1162/neco.1997.9.8.1735

[5] Hong, T., Pinson, P., Fan, S., Zareipour, H., Troccoli, A., & Hyndman, R. J. (2016). Probabilistic energy forecasting: Global Energy Forecasting Competition 2014 and beyond. International Journal of Forecasting, 32(3), 896-913. https://doi.org/10.1016/j.ijforecast.2016.02.001

[6] Bengio, Y., Simard, P., & Frasconi, P. (1994). Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, 5(2), 157-166. https://doi.org/10.1109/72.279181