← Back to selected work

Supporting project P3 · Retail analytics · Public data (FreshRetailNet-50K, China 2024)

The day ends early: what 4.5 million perishable store-product-days actually show

50,000 store-SKU series over 90 days from the open FreshRetailNet-50K dataset: a sell-through clock that runs out by mid-morning, a measurable weekend effect, and a forecast bake-off where the honest interval matters more than the accuracy trophy.

Completed v1.0 · 14-day out-of-sample test Data: public, CC BY 4.0 (attribution: Dingdong-Inc) Normalised units — relative magnitudes, disclosed everywhere
4,500,000store-product-days analysed
61.8%of SKU-days out of stock within 2 trading hours
4.0%fully stocked through close (mostly slow movers)
+19.8% / +21.0%Saturday / Sunday sale index vs baseline
0.131best WAPE on 12,572 unseen store-days (mean-7)
80.4%naive-method 80% PI coverage — the only interval that kept its promise

What is real and what isn't — on this page

Real

  • All numbers computed from the authentic train split (…/resolve/main/data/train.parquet; pulled 2026-10-24).
  • Grid verified: exactly 50,000 series × 90 days = 4.5M rows, 898 stores, 18 cities, 865 SKUs.
  • Forecast test set never touched during calibration (PIs from days 15–76; tests on 77–90).
  • 5 real build mistakes in AI_GOT_IT_WRONG.md — including one OOM crash.

Not claimed here

  • No absolute units: sale_amount is globally normalised by the provider; we report relative magnitudes only.
  • Sales are not treated as true demand where stockouts truncate observation — censoring is diagnosed, not silently "corrected".
  • Calendar/holiday deltas are descriptive associations, not causal effects.

00 The two-minute version

Headline: 61.8% of store-SKU-days are sold through within 2 trading hours; only 4.0% stay stocked to close — replenishment must start from the sell-through clock, not the daily total.

Business question
When does the day actually end for fast perishables — and can daily store demand be forecast with intervals that keep their promise?
Data
FreshRetailNet-50K train split (4.5M rows, CC BY 4.0, attribution Dingdong-Inc). REAL
Method
Streaming audit → store-day & SKU-day aggregates → comparable per-store index → deterministic forecast bake-off with pre-test-calibrated 80% PIs. REAL
Result
Sell-through 61.8% ≤2h; weekend +20%; holiday +30.0%; mean-7 WAPE 0.131; naive PI coverage 80.4% vs seasonal-naive's 69.2% (calibration failure, disclosed). REAL
Recommendation
Clock-first replenishment review; mean-7 point + naive-calibrated interval until per-store recalibration ships.
Limitations
Normalised units; sales ≠ demand under censoring; 90 days, one platform; deltas associative.
Next steps
Per-store interval recalibration, latent-demand model on censored hours, local retail pilot.

01 The problem

Perishables die twice: once when they expire on the shelf, once when the shelf is empty by 9 a.m. and every lost sale is invisible in the data — because sales records silently truncate when stock hits zero. Classic demand-forecasting teaches models on exactly these biased series and calls the result "demand".

This project separates the two honest tasks: (1) describe the sell-through clock as its own operational signal, using the dataset's in-stock hour counter as the source of truth; (2) run a forecast bake-off for sales (not "demand") with prediction intervals calibrated and graded out-of-sample. Everything is reproducible from a public CC BY dataset.

02 The data

ItemDetailVerifiedStatus / limit
DatasetFreshRetailNet-50K (train split) — Hugging Face Dingdong-Inc/FreshRetailNet-50K2026-10-24REAL — public
LicenceCC BY 4.0; attribution: Dingdong-Increpo cardAttribution carried on every derived artifact
Size4,500,000 rows = 50,000 store-SKU series × 90 days (2024-03-28 → 2024-06-25)streamed audit, exacteval split is one eval week only — procurement found via audit (ledger #1)
Coverage898 stores · 18 cities · 865 SKUs · 20 fields incl. hourly sales & stock flags, discount, holiday, weatheraudit printsone grocery platform, China
Key conventionstock_hour6_22_cnt = in-stock trading hours, window 06:00–22:00 (16 slots) — verified against hours_stock_status arrays3-row manual checknever assumed; always verified
Unitssale_amount globally normalised by providerrepo cardrelative magnitudes only; disclosed on every chart

03 The process

  1. Stream, don't slurp. 4.5M rows × 17 cols (two of them 24-slot arrays) OOM-killed the first naive load — the final pipeline streams 250k-row batches, array columns never materialised (ledger #3).
  2. Audit before selection. Exact grid check (50,000 × 90), dup keys, field ranges, the stock-hour convention verified against its own arrays — all printed in the run log.
  3. Two grains, both documented. store×day (forecasting) and binned SKU×day (sell-through clock) — nothing hand-typed into pages.
  4. Comparability without leakage: weekday/holiday effects measured on a per-store sale index (each store vs its own 90-day mean) — descriptive, so train-period normalisation is explicitly labelled.
  5. Temporal honesty in the bake-off: PI quantiles from days 15–76 only; graded on days 77–90. The test period was never seen by calibration.
  6. Censoring is diagnosed, not repaired: we forecast sales and say so; the demand-recovery problem is named as future work rather than silently assumed away.

04 What the data showed

Distribution of in-stock trading hours: 61.8 percent of SKU-days at 0-2 hours, only 4 percent fully stocked
So what: the fresh day is a sprint. Peak mean sale sits in the 3–6-hour bin (1.28 units) — the chain's revenue is decided before lunch, and the 4% that stays stocked all day sells almost nothing (0.05).
Weekday sale index: Thursday trough 0.87, Saturday 1.20, Sunday 1.21
So what: weekend demand is structurally ~20% above baseline (Thursday is the trough). Staffing and morning allocation should follow the weekday, not the weekly average.
Holiday days plus 30 percent, in-app activity days flat
So what: holidays move the register (+30.0%); in-app activity days don't (+0.5%). Descriptive, not causal — but a planning signal all the same.

05 The forecast bake-off

Largest store: actual sales, mean-7 forecast and 80 percent interval across the test fortnight
So what: simple tracks well at daily grain; the band matters more than the line.
WAPE by method: mean-7 0.131 best, seasonal-naive 0.133, naive 0.144
So what: mean-7 wins the accuracy contest (WAPE 0.131 on 12,572 unseen store-days).
80 percent interval coverage: naive 80.4, mean-7 77.6, seasonal-naive 69.2
So what: — and naive wins the honesty contest. Seasonal-naive's "80%" interval caught only 69.2% of the future: a silent 11-point gap that would under-order every weekend. The stack recommendation: mean-7 point forecast inside naive-calibrated bands, until per-store recalibration exists.

06 Limitations

  • Normalised units — no naira/yuan/units conversion exists in the data; every number reported is relative.
  • Censoring: sales truncate at stock-out; the "recovered demand" problem is explicitly future work, not assumed solved.
  • Coverage is pooled across 898 stores — smooths store-level calibration gaps (documented in the model card).
  • 90 days, one platform, one country — magnitudes are not portable; the methods are.
  • Discount-depth correlation (−0.614) is store-ecological — deeper-discount stores also differ in mix; no causal claim.

07 Impact & recommendation

  • Replenishment by clock: rank SKUs by first stock-out hour, not only units sold — the 61.8% ≤2h cohort is where morning allocation is won or lost.
  • Forecast stack: mean-7 point (WAPE 0.131) wrapped in naive-calibrated 80% bands (80.4% coverage) until per-store recalibration ships.
  • Holiday playbook: +30% sale-index days warrant pre-open allocation review; activity-flag-only days (+0.5%) do not.

Next steps: per-store PI recalibration; latent-demand model for censored hours; a licenced Nigerian retail pilot to re-derive magnitudes locally.

08 Tools used

Python/pyarrow (streaming extraction — memory-safe by design) · base R (descriptives, forecast bake-off, interval calibration) · Python/matplotlib (charts) · hand-coded HTML/CSS. AI-assisted with the published 5-entry bug ledger.

Named paths (R/…, AI_GOT_IT_WRONG.md, SOLUTIONS_LOG.md) are relative to this project's repo folder — browse the files on GitHub ↗ (verified live 2026-10-25).