Predicting how many units will sell next quarter, what the electricity demand will be tomorrow at eight in the evening, or when a machine will fail are all problems of time series prediction (forecasting). Unlike an ordinary classification model, here the data arrives ordered in time and carries dependencies: today's value depends on yesterday's, on the season of the year and, often, on external variables. This article walks through classic models such as ARIMA and SARIMA, approaches based on neural networks, the right metrics to evaluate them and the methodological mistakes that invalidate an apparently flawless forecast.
Components of a time series
Any time series can be decomposed into four components. The trend is the long-term direction (sustained growth in sales). Seasonality is the pattern that repeats with a fixed period (more ice cream in summer, more electricity at dusk). The cyclical component captures oscillations of variable duration tied to the economy. And the noise, or irregular component, is the unpredictable part. Understanding this decomposition is not an academic exercise: it determines which model is appropriate and how the data must be transformed before modelling.
A central concept is stationarity: a series is stationary if its statistical properties (mean, variance, autocorrelation) do not change over time. Most classic models require stationarity, which is achieved by differencing the series (subtracting the previous value) and, sometimes, applying logarithmic transformations to stabilise the variance. The Augmented Dickey-Fuller (ADF) test makes it possible to test statistically whether a series is stationary.
Classic models: ARIMA and SARIMA
The ARIMA model (AutoRegressive Integrated Moving Average) is the cornerstone of time series statistics. It is parameterised as ARIMA(p, d, q): p is the autoregressive order (how many past values influence the result), d is the degree of differencing needed to make the series stationary, and q is the moving-average order (how many past errors are incorporated). The autocorrelation (ACF) and partial autocorrelation (PACF) plots guide the choice of these parameters.
When the series has seasonality—the usual case in business—SARIMA is used, which adds a seasonal block (P, D, Q)m where m is the cycle length (12 for monthly data with annual seasonality). SARIMA allows external regressors to be incorporated (SARIMAX variants), for example holidays, prices or temperature, which usually improve demand forecasting considerably. Its great advantage over neural networks is interpretability and the fact that it works well with little data, something decisive when you only have two or three years of history.
Modern approaches: from Prophet to neural networks
For teams without an econometrics specialist, Prophet offers an additive model that separates trend, seasonality and holiday effects with minimal configuration, tolerating gaps and outliers. It is an excellent starting point and a baseline that is hard to beat.
When there are large volumes of data and non-linear relationships, recurrent neural networks come into play, in particular LSTMs (Long Short-Term Memory), designed to capture long-term dependencies without suffering the vanishing gradient of simple RNNs. More recently, architectures based on Transformers (models such as the Temporal Fusion Transformer or N-BEATS) have shown outstanding results in large-scale forecasting competitions, especially when trained on thousands of related series at once (global forecasting). The price paid is higher: they need a lot of data, are expensive to train and their interpretability is limited, which matters in regulated sectors.
Comparison of approaches
| Criterion | SARIMA | Prophet | LSTM / Transformers |
|---|---|---|---|
| Data required | Little (2-3 cycles) | Moderate | A lot |
| Non-linear relationships | Limited | Limited | Excellent |
| Interpretability | High | High | Low |
| Training cost | Low | Low | High |
| Multiple series at once | No | Limited | Yes (global model) |
| Ideal use case | Demand with short history | Fast baseline | Thousands of series, non-linearity |
Temporal feature engineering
Above the choice of model, what usually moves the needle most in a real project is feature engineering. From the timestamp you derive calendar variables (day of the week, month, holiday, day before a holiday, end of month) that capture patterns the model does not infer on its own. Lag variables (the value from 1, 7 or 365 periods ago) and moving averages provide explicit memory. For models that do not handle seasonality natively, cyclical encodings with sines and cosines represent the hour or month as a continuous variable that respects circularity (11 p.m. is close to midnight). And exogenous variables—price, marketing campaigns, weather, macroeconomic indicators—usually explain the variance the series itself does not contain.
Outliers and gaps must be handled carefully. A spike caused by a one-off promotion or an incident should be flagged as an event, not learned as a recurring pattern. Gaps should be imputed with judgement (interpolation, last known value, or a specific model), never filled with zeros that the model would interpret as genuine zero demand.
Probabilistic forecasting: uncertainty matters
An isolated number—"we will sell 4,200 units"—is almost useless for deciding. What the business needs is a probabilistic forecast: an interval with its confidence level ("between 3,800 and 4,600 units with 90% probability") or, better still, full percentiles. Inventory planning, for example, is not done on the mean but on a high percentile to guarantee the service level without overstocking. Models such as SARIMA and Prophet deliver intervals natively; in neural networks they are obtained through quantile regression or uncertainty-estimation techniques. Ignoring uncertainty and planning only with the mean value is one of the silent causes of stockouts and of excess tied-up capital.
How to evaluate a forecast correctly
Evaluation is where most projects fail silently. You cannot use random cross-validation: you have to respect the temporal order with sliding-window backtesting (train on the past, validate on the immediate future, and advance). The usual metrics are MAE (mean absolute error), RMSE (which penalises large errors more) and MAPE (percentage error, intuitive but unstable with values close to zero). To compare series of different scales, MASE is useful, as it measures the error against a naive reference model. A forecast is only good if it beats the naïve baseline (repeating the last value or the value from the same period a year earlier); it is surprising how many complex models fail to do so.
Phased implementation
A well-governed forecasting project follows a clear sequence: (1) define the horizon and granularity of the forecast according to the business decision it will feed; (2) clean the data by handling gaps, outliers and calendar changes; (3) establish a naive baseline as a yardstick; (4) first try an interpretable classic model (SARIMA or Prophet); (5) scale up to neural networks only if the data volume and the measured improvement justify it; and (6) monitor drift in production, because every series changes regime sooner or later and the model must be retrained.
Regulatory framework and responsible use
When the forecast feeds decisions that affect people—shift planning, dynamic pricing, granting credit—the European Artificial Intelligence Regulation (AI Act) comes into play, classifying systems by risk level and requiring transparency and human oversight for high-risk ones. If the model processes personal data (for example, predicting individual consumption), the GDPR also applies, with its principles of minimisation and purpose limitation. Documenting what data goes in, how the model is trained and what margin of error the forecast has is not bureaucracy: it is the foundation of trust and of your defence in an audit.
Common mistakes to avoid
The most serious is temporal data leakage: using information from the future to predict the past, usually by normalising with statistics computed over the whole dataset. The second is ignoring the baseline and celebrating a model that does not actually beat it. The third is overfitting to unrepeatable events (a one-off promotion, a pandemic) without flagging them as outliers. The fourth is deploying the model and forgetting it: without monitoring the error in production, degradation goes unnoticed until it triggers a costly bad decision.
Frequently asked questions
How much historical data do I need for a good forecast?
For seasonal models, at least two or three complete cycles are advisable (two or three years for monthly data). With less, classic models remain more reliable than neural networks, which require large volumes.
ARIMA or neural networks: which should I choose?
Always start simple. SARIMA or Prophet solve most business cases with good interpretability. Neural networks only pay off when there is a lot of data, clear non-linear relationships and a measured improvement over the baseline.
Why can't I use normal cross-validation?
Because it would mix past and future, giving an optimistic and unrealistic error estimate. In time series, sliding-window backtesting is used, which respects the chronological order.
How often should I retrain the model?
It depends on the speed of business change, but it is advisable to monitor the error continuously and retrain when it exceeds a threshold or when a regime change is detected, rather than on an arbitrary fixed calendar.
Conclusion
Forecasting is not about finding the most sophisticated algorithm, but about framing the problem well, respecting time in evaluation and honestly beating a naive baseline. A well-specified SARIMA often beats a poorly validated neural network, and a forecast with its explicit confidence interval is infinitely more useful for decision-making than a single number with no uncertainty. The real competitive edge lies in the complete loop: clean data, an interpretable model, rigorous backtesting and drift monitoring in production. At Summum Marketing we build prediction systems by working backwards from the business decision—what horizon, what granularity, what margin of error is tolerable—rather than starting from the model, because a forecast nobody knows how to use is just a pretty number on a dashboard.