Forecasting & Time Series
Applied ML articles on forecasting, feature engineering, NLP, production ML, graph analytics, conformal prediction, label engineering, and decision-oriented modeling — from real projects at Sofrecom (Orange Wholesale), Tunisia Telecom, Kiota Intelligence, and Zindi.
Forecasting and time-series insights on temporal structure, model evaluation, feature engineering, and deployment decisions. Browse all insights in this category, or view all insights.
Decomposition is not only a preprocessing step
Time series decomposition can be a modelling decision — not just preprocessing.
Choose to model directly or decompose components based on stability, noise, and interpretability needs.
Result: Evaluate direct vs component-wise forecasting as part of your strategy.
A forecast-routing system can fail before the forecasting model does
In multi-entity forecasting, routing is part of the system. If the router misclassifies regimes or leaks future information, even the best forecaster fails.
Validate the router and the full decision chain, not just individual forecasts.
Result: Router errors matter — test routing in isolation with decision-time features and validate end-to-end.
This was not hyperparameter tuning. It was forecasting architecture search.
In one forecasting project, the difficult part was not choosing a regressor. It was deciding how the forecasting framework itself should be configured.
With MLForecast, the meaningful choices went beyond model parameters — lags, features, validation, and search policy.
Result: Treat the forecasting framework as a search space. This is architecture search, not just hyperparameter tuning.
Forecasting code is not a forecasting system
A notebook that produces forecasts is forecasting code. Production requires reliable data, validation/feature pipelines at prediction time, model release gates, decision delivery with exceptions, and monitoring with a learning loop.
Result: The model is one component. The system is everything required to make forecasts reliable and useful when normal conditions fail - and it must support decisions, not just produce numbers.
Conformal prediction: calibrated forecast intervals
A point forecast says what the model expects; it does not say how much risk the plan is taking. Conformal prediction wraps any forecasting model in a prediction interval built from errors on held-out calibration data, so a 90% interval targets 90% long-run coverage instead of an assumed error distribution.
Result: A point forecast with a calibrated interval — 1,200 units with a 980 to 1,420 range — and coverage stated as a long-run property, backtested by horizon, segment, and future period before capacity plans depend on it.
5 Forecasting Habits R Taught Me
Working in R taught me five forecasting habits I still bring into Python workflows: aggregate noisy series before modelling them, inspect residuals before changing the architecture, combine models with genuinely different errors, let sparse groups borrow strength from related ones, and simulate uncertainty instead of reporting one number.
Result: Different tool ecosystems teach different habits, but the habits transfer — not the syntax. R did not make the forecasting better; it made residual checks, hierarchical structure, and uncertainty harder to ignore. Those questions matter more than the language you ask them in.
R Forecasting at Scale: 200 Series, 4 Baselines
Forecasting one series is easy to prototype; forecasting hundreds consistently is a workflow problem. With tsibble, fable, and feasts, a panel of series becomes a first-class object and one declaration fits four baseline families — ETS, ARIMA, naive, seasonal naive — across every series.
Result: Different series favour different baselines, so there is rarely one universal winner. The question is not “which model is best?” but whether the workflow can evaluate sensible alternatives per series using a realistic validation design. At scale, the workflow matters as much as model choice.
Time-Series Cross-Validation: Train on the Past, Validate on the Future
Random K-fold lets training observe periods that occur after validation, producing overly optimistic scores, misleading comparisons, and false confidence before deployment.
Result: Use time-aware splits — expanding, sliding, or blocked holdout with a gap — and validate on the future. If a forecasting score looks too good, inspect the split first.
Better Tools, Same Forecasting Principles
Better forecasting tools speed up the workflow, but they don't replace the fundamentals: realistic validation, domain knowledge, feature design, and honest comparison.
Result: The baseline should make complexity earn its place. If a simple, well-validated baseline beats a complex approach on realistic future periods, keep it simple.
The forecast was wrong because the routing was
In a multi-series forecasting project, not every series behaves the same way at the same moment. Some accelerate, some flatten, some have almost no signal, and some are too noisy for a more complex model to help. Sending every series through one strategy hides those differences.
Result: A lightweight routing layer measures recent trajectory at the forecast origin, classifies a current regime, and routes each series to candidate strategies suited to it. Improving the routing logic created more lift than another round of model tuning — model selection can be conditional on current series behaviour.
Purged Cross-Validation Is Not for Every Time Series
A time-aware split removes the obvious leak — future rows inside training — but does nothing about a training row whose label reaches into the validation window. A forward 10-day return dated just before the boundary is realised across the very period the model is being judged on, and the metrics come out quietly optimistic.
Result: I diagnose the label instead of applying a ritual gap. Purging overlapping training rows and adding an embargo fixed the datasets whose labels spanned a window. For point-in-time labels with causal features the plain split was already correct, and an arbitrary gap only discarded training data the model needed.
Make a Simple Forecasting Baseline Fail First
DLinear reaches competitive time series accuracy with almost no architecture: decompose the series into a trend and a residual component, project each one linearly into the forecast horizon, then add the two forecasts together. No attention blocks, no transformer stack.
Result: More architecture does not automatically create more forecast value. Start with a statistical benchmark, add a decomposed linear baseline, and keep the deeper model only when a fair point-in-time backtest shows a clear, stable advantage that justifies its latency, tuning, and maintenance cost.
Route Structurally Inactive Series Before Forecasting
Some time series should be routed before forecasting - not learned by the forecasting model. In a weekly forecasting pipeline, some entities had long runs of zero activity, and the question was not whether the model could learn the pattern but whether it was still an active forecasting problem.
Result: When an entity met a carefully defined inactivity rule, I routed it outside the active forecasting path to a monitored deterministic zero forecast, and kept active or uncertain entities in the normal forecasting workflow.
Seed Sensitivity Is Part of Model Selection
A configuration that wins once is not necessarily a good configuration. In a forecasting-search workflow, some candidate configurations look excellent in one run - until the seed changes and the result changes too. That is a problem when the search process contains randomness: stochastic fitting, random sampling, evolutionary or genetic search, random feature or lag exploration, or resampled validation.
Result: Evaluate promising configurations across multiple seeds, then select based on a robust aggregate such as the median result. The flashy single-run winner can disappear, but configurations that stay strong across repeated runs become easier to trust.
Foundation Models Raise the Baseline
Time-series foundation models produce a credible forecast with minimal custom setup — that raises the standard for any pipeline that adds complexity. But forecasting performance often depends on information outside the target history: promotions, pricing, holidays, weather, and operational events.
Result: Start with a simple statistical benchmark, add a zero-shot foundation-model benchmark, then build an engineered model with valid external signals. Compare all three with rolling-origin backtesting on accuracy by horizon and segment, latency, cost, interpretability, and operational complexity — and ship the best trade-off.
Zero-Shot Forecasting Changes the Baseline
A zero-shot forecasting foundation model returns a forecast with prediction intervals from a single historical series — no manually engineered lags, no hyperparameter search, no training loop. It does not automatically become the best production solution, but it changes what a strong baseline can look like.
Result: Establish a simple statistical baseline, add a zero-shot benchmark, build the engineered pipeline, and compare every candidate fairly with rolling-origin backtesting — then ship the approach with the best trade-off between accuracy, cost, latency, explainability, and operational complexity.
Aggregate → Forecast → Disaggregate — Forecast at the Level of the Signal
If daily data is noisy, a daily forecast may not be the best starting point. Aggregating daily demand to a stable weekly level, forecasting there, then distributing the forecast back to daily reduces the noise the model has to chase.
Result: Forecast at the resolution of the signal, not the data. Daily forecasts must sum back to the weekly total — and backtest aggregation against the direct forecast on the same validation windows.
Turning Decomposition into a Forecasting Strategy
In this forecasting work, a raw weekly time series mixes several dynamics at once. Instead of fitting one model directly, I generated multiple decompositions, selected the one with lowest combined residual error, and forecast each component with the model family best suited to its behavior.
The adjusted component is modeled with ARIMA + calendar/holiday regressors. The seasonal component is modeled separately with ETS. The final output is stabilized with rolling median smoothing across iterations.
Result: Decomposition became a modeling decision layer — the best decomposition is the one that creates the most predictable sub-signals.
The hardest forecasting decision is not which model to use!
In a multi-entity time series problem, I spent more time on routing than on model tuning. The series were too heterogeneous: some decelerating, some accelerating, some near-zero, some ambiguous.
Before fitting anything, I built a classification layer: compute elasticity score, classify each entity into a trajectory regime, route to a different forecasting strategy per regime.
Result: When you have many entities to forecast, don't just build a better model. Build a better routing system.
MLforecast Made Me Rewrite My Forecasting Pipeline
In multi-series forecasting, the same mechanics repeat: lags, rolling transforms, calendar features, time ordering, multi-step forecasts. MLforecast lets you define that recipe once and apply it consistently across every series.
Result: Good tooling moves effort away from repeated feature plumbing and toward the forecasting decisions that actually matter.
Share on LinkedIn →