Does a Learned Stock Forecast Beat the Last Four Weeks?

Compare forecasts for eight products with later invoice quantities before turning any forecast into an order.

A shopkeeper examines a stock ledger beside an open carton of goods.
A forecast of next week's invoices can be tested against the units eventually recorded.

An inventory AI model learns from recorded transactions. When a product sells out early, invoices show only the units customers could buy. To make that distinction concrete, Yenra tested a forecasting method on later weekly invoice quantities. The test measures recorded units, with no claim that every unfilled request is visible.

Choose the products before the test begins

A man in the office is analyzing data on his computer screen.
Later bestsellers must not influence the selection of products for an earlier forecast.

Daqing Chen’s Online Retail archive records transactions for a UK-based online retailer. We used 52 complete Monday-to-Sunday weeks starting December 6, 2010. We kept UK rows with positive quantity and price, excluded cancellation invoices, and restricted stock codes to five digits optionally followed by letters. From the first 40 weeks we selected the eight codes with the largest summed units. A week with no qualifying invoice counts as zero observed units. Daqing Chen’s Online Retail dataset at UCI

Compare the next week with two simple forecasts

An automated reordering system in a warehouse setting, featuring a laptop and robotic arm.
Replenishment needs a method that earns its place against a usable baseline.

We fitted a separate ridge regression for each product on weeks 9–40 using the prior week, four-week mean and eight-week mean as inputs. Inputs were standardized using the training rows. The penalty was ten with an unpenalized intercept. Coefficients stayed fixed over weeks 41–52, but each forecast could use the preceding observed weeks. Negative predictions were floored at zero. Across the 96 later product-weeks, mean absolute errors were 468.6 units for last week, 392.0 for the four-week mean and 461.1 for the fitted method. The four-week mean won this comparison.

Average unit forecast error by week for eight products, with the fitted forecast and the four-week mean compared over twelve held-out weeks.
Each point averages absolute errors for eight products in that week. Across all 96 observations, the four-week mean missed by fewer units on average. Open the full-size chart.

Download all 96 product-week forecasts (CSV). The columns give week beginning, stock code, observed positive invoiced units, last week’s units, the prior four-week mean and the fitted prediction. Adapted and aggregated by Yenra from Daqing Chen’s Online Retail dataset at UCI, licensed under CC BY 4.0. Creative Commons license.

Translate units into an order only after checking supply

A man stands in front of a large screen displaying a world map, observing something related to supply chain management.
Forecast error, stock on hand and supplier lead time affect different parts of an order.

A buyer still needs the usable inventory position, committed orders, case pack and delivery window. Demand during a two-week lead time may be quite different from next week’s invoices. The M5 competition illustrates the importance of evaluating retail forecasts at the product and aggregation levels actually used. These eight active codes represent a selected part of one retailer. The M5 retail forecast competition results Why Can an Item Be in Stock and Still Unavailable to a Shopper?

Try it with the evidence

Turn a demand assumption into a case order

Source notes. Fictional one-week lead time. Expected use is 42 units, target buffer 8, on hand 31 and confirmed inbound before need 7. No backorders. The supplier ships cases of six. Round up to meet the target.

Prompt. Calculate the net requirement and number of cases. Which input changes first if the inbound shipment slips?

Check your reading

The target is 50 and available stock is 38, leaving a 12-unit requirement or two cases. If the seven inbound units miss the window, available stock is 31. The gap becomes 19, requiring four cases if all other assumptions stand.

Illustrated field notes

Stock measurement and physical flow

Track the movement that changes the count and distinguish a recorded zero from an unknown quantity.

Aerial view of a warehouse or distribution center, showcasing its layout and various components.
Physical slotting changes the travel required to pick stock.
A robot is being used for warehouse automation and optimization in a warehouse setting.
Record the item and location for each automated movement.
A worker uses an inventory tracking system to monitor and manage stock levels in a large warehouse.
A ledger count needs reconciliation with physical observations.
A woman in a blue lab coat and safety glasses holds a tablet while standing in front of a row of bottles in an industrial or manufacturing facility.
A positive on-hand balance may include goods that cannot be sold.
An assortment of Return Processing equipment and packaging materials arranged neatly on shelves or in cabinets.
Separate returned units from new demand.
Forecasts, replenishment and availability

Ask which shortage, lead time or lost sale the invoice series cannot reveal.

A person's hand is poised to interact with a digital screen displaying a complex graph or chart in an office setting.
A markdown decision depends on shelf life, stock and margin.
A woman sitting on the floor in front of a shelf stocked with skincare or makeup items.
Availability should be assessed for the customer's exact variant.