Forecasting Fresh Food Demand: Beyond Regression
Why fresh food retail needs adaptive, probabilistic and decision-aware forecasting, and how to build it step by step.
Short answer: traditional regression is still useful, but for fresh food retail you should look beyond static models toward adaptive forecasting, probabilistic deep learning, and decision-aware inventory optimization.
Fresh food is a hard forecasting problem. Demand and supply shift quickly, products have short shelf lives, and the cost of being wrong is asymmetric: order too little and you lose sales, order too much and you throw money away.
Take a supermarket selling strawberries. It has to cope with:
- Rapid demand swings from weather, promotions, weekends, and holidays.
- Short shelf life and expiration.
- Uncertain supplier deliveries and product quality.
- Markdowns as products approach expiry.
- Stockouts that hide true customer demand.
- Substitution between products when one runs out.
A model that predicts average demand accurately can still perform badly if it cannot adapt quickly or account for perishability. The most promising path is not to swap regression for one new algorithm, but to combine adaptive forecasting, uncertainty estimation, inventory simulation, and financial optimization.
- Start with recency-weighted, quantile-based gradient boosting (e.g. LightGBM) and drift monitoring.
- Observed sales are not demand: stockouts censor the data, so correct for them.
- Model product age and expiry explicitly, not just total stock.
- Judge models by profit, waste, and service level, not forecast error alone.
- Only then test deep models, foundation models, or reinforcement learning.
1. Which modern approaches are worth considering?
I group the options into five families.
| Approach | Examples | Why it helps with fresh food | Main limitation |
|---|---|---|---|
| Adaptive machine learning | LightGBM with recent-data weighting, online learning, drift detection | Adapts to changing demand patterns | Needs reliable monitoring and updating |
| Deep time-series models | Temporal Fusion Transformer (TFT), N-HiTS, PatchTST | Learns nonlinear temporal patterns and interactions | Needs substantial data and careful validation |
| Foundation models | TimesFM, Chronos, Moirai | Transfers patterns from other series, reducing training effort | Not necessarily better on your retailer's data |
| Probabilistic & ensemble forecasting | Quantile models, distributional models, ensembles | Represents uncertainty and supports risk-aware ordering | Uncertainty must be calibrated |
| Decision-focused AI | Model predictive control (MPC), reinforcement learning, simulation-based optimization | Optimizes decisions around waste, stockouts, and constraints | Harder to train, validate, and deploy safely |
Recent research targets this setting directly. A 2026 study in the International Journal of Forecasting examines high-frequency omnichannel grocery demand with a deep-learning framework that separates structural demand patterns from short-term fluctuations, which is useful when promotions or other temporary events disrupt regular demand.[1]
2. Adaptive forecasting: handle change without rebuilding everything
This is where I would start for highly dynamic data.
Suppose a supermarket normally sells 100 units of strawberries a day. A heatwave arrives, a promotion begins, and demand jumps to 170. A model trained on older data keeps predicting about 100, because the relationships it learned no longer describe current conditions. This is concept drift: the statistical relationship between inputs and the target changes over time.
A. Recency-weighted learning
Instead of treating every historical observation equally, give recent ones more weight. A simple exponentially decaying weight is:
- wi: weight of historical observation i
- t: current forecasting time
- ti: time when observation i occurred
- λ > 0: decay parameter controlling how fast older observations lose influence
The training objective becomes:
where L is the chosen loss function. For quantile regression, L can be the pinball loss.
Interpretation: recent observations shape the model more strongly, while older ones still contribute. This helps with gradual change, but it is not enough on its own when an abrupt shock occurs.
B. Drift detection and adaptive retraining
Monitor:
- Forecast errors and systematic under-prediction.
- Changes in demand distributions.
- Changes in how promotions affect sales.
- Forecast calibration.
If a detector flags a meaningful deterioration, the system can retrain or switch models. A practical loop looks like this:
Handle the delay between forecast and observation carefully. In retail, observed sales can be lower than true demand because the product was out of stock (more on that in section 5).
Recent work has studied drift-aware boosting with temporal weighting,[2] and other research proposes adaptive demand forecasting with automated drift detection for inventory optimization. These directions are promising, but gains reported in individual studies should not be assumed to generalize to every retailer.
Start with recency-aware gradient boosting and drift monitoring before adopting a complicated deep-learning architecture. It gives you a strong, operationally manageable baseline.
3. Deep time-series models: learn complex temporal patterns
Traditional regression predicts demand from a set of features. Deep time-series models can learn richer relationships across historical sequences and many related variables.
A. Temporal Fusion Transformer (TFT)
TFT is built for problems that mix historical observations with inputs known in advance. For fresh food, those inputs might include:
- Historical sales and prices.
- Historical weather and future weather forecasts.
- Planned promotions.
- Day of week and holidays.
- Inventory availability.
The model combines temporal representations with attention to learn how features relate to each forecasting horizon. It might learn that a product's demand rises before weekends, responds strongly to promotions, and is sensitive to temperature. Its variable-selection and attention mechanisms help you inspect predictions, but they should not be read as causal explanations.
Use it when you have substantial history across many products and stores, several useful explanatory variables, and the resources to train and validate deep models.
B. N-HiTS and PatchTST
- N-HiTS uses hierarchical interpolation and multi-scale processing to capture patterns at different temporal resolutions.
- PatchTST splits time series into patches and applies Transformer representations to model temporal dependencies.
Both can capture seasonality, trends, and longer-range dependencies. Neither automatically solves concept drift: a model can learn history very well and still fail when the demand process changes. For fresh food, benchmark them against a well-engineered LightGBM baseline rather than assuming a fancier architecture wins.
4. Time-series foundation models: transfer knowledge from other series
Models such as TimesFM, Chronos, and Moirai are pretrained on large collections of time series. Depending on the model and configuration, they can forecast a new series without training from scratch. The idea mirrors transfer learning in NLP: a language model learns from large text corpora, while a time-series foundation model learns from large collections of numerical sequences.
How could this help a supermarket?
Imagine hundreds of products, some with very little sales history. A per-product model may struggle on those. A pretrained model could provide a useful first forecast with no product-specific training.
- A generic model may not understand retail promotions or product substitution.
- It may not know that a stockout has censored observed sales.
- It does not model expiration or inventory constraints.
- It may perform worse than a well-trained retail-specific model.
Recent benchmarking of time-series foundation models also finds that performance depends on the dataset and architecture, with no universally best model.[3]
Recommendation: test a foundation model as an extra candidate, especially with many products or thin per-product data, and keep a retail-specific model as the benchmark.
5. The critical issue: observed sales are not demand
This matters more than which architecture you pick. Suppose a supermarket has 10 units of strawberries and customers want 25. It sells 10, and the product becomes unavailable. The dataset records:
If you train directly on observed sales, the model learns that demand is only 10. That starts a feedback loop:
- The model underestimates demand.
- The inventory system orders too little.
- Stockouts become more frequent.
- Observed sales stay artificially low.
- The model keeps underestimating demand.
This problem is called censored demand. A 2026 study on leakage-free forecasting and inventory optimization for perishable goods, using the FreshRetailNet-50K benchmark, stresses accounting for censoring and avoiding evaluation setups that accidentally use unavailable future information.[4]
What can you do?
- Exclude or separately handle observations with known stockouts.
- Estimate latent demand using availability information.
- Model demand and product availability jointly.
- Use probabilistic methods that account for censoring.
- Validate against periods when products were sufficiently available.
If you record availability through the day, you can tell a genuine 10-unit sale from a sell-out. That distinction can be worth more than replacing one forecasting algorithm with another.
6. Model perishability explicitly: forecasting alone is not enough
Fresh inventory has an age and an expiry date. Suppose you hold:
- 20 units that expire tomorrow.
- 40 units that expire in three days.
- 60 newly delivered units that expire in seven days.
That is 120 units in total, but they are not interchangeable. A conventional inventory model treats them as identical; a perishability-aware model tracks remaining shelf life.
6.1 Age-structured inventory
Let It,a be the quantity at time t with age a:
- It,0: newly received inventory
- It,1: inventory aged one day
- It,2: inventory aged two days
The inventory state now holds both quantity and age. A simulation can then account for sales, aging, expiration, replenishment, markdowns, and waste. It can also apply a first-expired-first-out (FEFO) policy, selling the products that expire first, where operationally appropriate.
6.2 Optimize waste and availability together
Consider two ordering policies with these hypothetical results:
| KPI | Policy A | Policy B |
|---|---|---|
| Expected sales revenue | €100,000 | €104,000 |
| Gross profit | €30,000 | €31,000 |
| Waste cost | €4,000 | €2,000 |
| Fill rate | 94% | 97% |
| Average inventory value | €15,000 | €17,000 |
Policy B earns more revenue and profit, wastes less, and fills more orders, but ties up more capital in stock. Whether it is better depends on the full cost structure, including the cost of holding that inventory. The objective should reflect the economics of the business, not just minimize forecast error.
Research on simulation-based inventory management for perishables has also looked at how customer substitution affects decisions, which matters when a shopper who cannot buy one product picks another.[5]
7. The most advanced direction: decision-focused AI
So far we have treated forecasting and inventory optimization as two stages:
That is a sensible architecture, but it has a gap. The forecasting model minimizes a statistical loss such as mean squared error or pinball loss, while the retailer cares about profit, waste, and availability. A small forecast error can be costly if it causes a stockout in a high-demand period; a larger error may cost little if there is enough stock. This motivates decision-focused forecasting and optimization.
7.1 Model predictive control (MPC)
MPC repeatedly plans future actions using the latest information. At each decision time, the system:
- Forecasts demand over a future horizon.
- Simulates or optimizes inventory decisions over that horizon.
- Implements only the immediate decision.
- Observes new information.
- Repeats.
For example, every morning the system could plan orders for the next seven days but execute only today's. Tomorrow it folds in new sales, weather forecasts, stock levels, and supplier information, then replans. MPC is not a forecasting algorithm; it is a control and optimization framework that uses forecasts and system dynamics to make sequential decisions.
7.2 Reinforcement learning
An RL agent learns a policy that maps the current state of the inventory system to an action:
- st: system state at time t (inventory, product age, demand forecasts, and so on)
- at: action, such as an order quantity or markdown
- πθ: the policy learned by the agent
- θ: parameters of the policy
The agent learns by evaluating the long-run consequences of its actions. A reward function might be:
The goal is a policy that maximizes cumulative expected reward over the planning horizon. Recent research has combined Transformer-based demand forecasting, deep reinforcement learning, and constrained optimization for perishable inventory.[6] The results are promising, but improvements are specific to each experimental setting and should be checked against simpler baselines.
Do not start with RL in production. Build a reliable forecasting model and a simulator first, then use the simulator to test whether RL beats established inventory policies by a meaningful margin.
8. A recommended architecture for a fresh food retailer
I would build the system in layers:
| Layer | Recommended approach | Purpose |
|---|---|---|
| Data engineering | Sales, inventory, prices, promotions, weather, shelf life, supplier data | Build a reliable view of the retail system |
| Baseline forecasting | LightGBM with engineered time-dependent features | Establish a strong, efficient benchmark |
| Adaptive forecasting | Recency weighting, drift detection, scheduled or event-triggered retraining | Adapt to changing demand |
| Probabilistic forecasting | Quantile regression or a calibrated distributional model | Estimate demand uncertainty |
| Advanced forecasting | TFT, N-HiTS, PatchTST, or a foundation model | Test whether deep models improve performance |
| Demand correction | Censoring-aware demand estimation | Avoid treating stockout-limited sales as true demand |
| Inventory simulation | Monte Carlo simulation with lead times and age-structured inventory | Evaluate possible futures |
| Inventory optimization | Newsvendor where applicable, MPC, or simulation-based optimization | Select replenishment and markdown policies |
| Financial evaluation | Revenue, gross profit, GMROI, inventory turnover, waste and service-level metrics | Measure business impact |
| Explainability | SHAP for forecasts, explicit policy explanations, KPI decomposition | Explain predictions and decisions |
| Monitoring | Calibration, drift, waste, stockouts, financial performance | Detect deterioration and support adaptation |
This is a more complete solution than simply picking a new neural network.
9. How to evaluate the models
Compare candidates at three levels.
Level 1: Forecasting performance
- MAE or WAPE for point forecasts (take care when actual demand is zero or very small).
- Pinball loss for quantile forecasts.
- Calibration of predicted quantiles.
- Performance during promotions, heatwaves, holidays, and other unusual periods.
Level 2: Inventory performance
- Fill rate and stockout rate.
- Waste and expiration.
- Average inventory.
- Ordering costs.
Level 3: Financial performance
- Revenue and gross profit.
- Inventory turnover and GMROI.
- Working capital tied up in inventory.
- Expected total cost.
Use rolling-origin backtesting: train on information available at a historical date, forecast the next period, advance the date, and repeat. Crucially, compare every model under the same inventory simulation and cost assumptions. Otherwise an apparent forecasting gain may not translate into a real business improvement.
10. What would I build first?
For a practical project, I would prioritize three developments, in this order:
- Adaptive probabilistic forecasting. Use a strong retail-specific model such as LightGBM with quantile loss, then add recency weighting, drift monitoring, and calibration.
- Perishability-aware simulation. Model stockouts, supplier lead times, product aging, expiration, waste, and markdowns. This is where forecasting becomes useful for real operational decisions.
- Decision optimization with explainability. Compare replenishment policies on expected profit, waste, service level, and working capital, and explain both the forecast and the business rationale behind each recommendation.
Only after that baseline is in place would I invest heavily in foundation models, complex Transformers, or reinforcement learning.
Fresh food forecasting is not just predicting a changing time series. It is making sequential decisions under uncertainty, with perishable inventory, incomplete observations, and competing financial objectives. The strongest solution is usually a combination of adaptive machine learning, probabilistic forecasting, simulation, and operations research, not simply a newer regression model.
References
- Improving high-frequency demand forecasts for omnichannel grocery retail. International Journal of Forecasting. doi.org/10.1016/j.ijforecast.2025.10.003
- A drift- and recency-aware boosting framework for robust forecasting under nonstationary data streams. Machine Learning with Applications. doi.org/10.1016/j.mlwa.2026.100927
- Benchmarking Time Series Foundation Models on their Accuracy and Energy Consumption. Proceedings of Machine Learning Research. proceedings.mlr.press/v309/guibert26a
- A Reproducible, Leakage-Free Pipeline for Censored Demand Forecasting and Inventory Optimization on FreshRetailNet-50K. MDPI. mdpi.com/2411-5134/11/5/89
- Simulation-based inventory management of perishable products via linear discrete choice models. Computers & Operations Research. doi.org/10.1016/j.cor.2023.106270
- Deep Reinforcement Learning for Adaptive Demand Forecasting and Perishable Inventory Optimization in Multi-Echelon Supply Chain. IEEE Conference Publication. ieeexplore.ieee.org/abstract/document/11382835
The strawberry and policy-comparison figures above are illustrative examples, not measured results.
Comments
Post a Comment