Decoding an E-Commerce Delivery Crisis
An international e-commerce company had nearly 60% of shipments arriving late. Five machine learning models later, the real finding wasn't a prediction — it was a diagnosis.
In a market shaped by next-day delivery expectations, logistics is customer retention. The brief was simple on paper: build a model to predict which packages would be delayed so the supply chain team could act proactively. What the data revealed was a far more complex picture.
Explore the Power BI dashboard
The original dashboard shows delay rates of 58–60% across every shipping mode and warehouse block: the lack of a standout bar is part of the finding. Having trouble viewing it? Open the dashboard directly.
When the model's failure became the finding
Feature engineering
Cleaned shipment data covering mode of shipment (flight, ship, road), warehouse block, product weight, and customer importance rating; one-hot encoded the categoricals and scaled the numeric features.
Testing a spectrum of models
Started with baseline distance and linear models — k-NN and SVM — to understand how the data behaved fundamentally, then escalated to the industry-standard ensemble methods: Random Forest, Gradient Boosting, and XGBoost.
Hitting a hard ceiling
Every model, from the simplest to the most sophisticated, plateaued around 63–67% accuracy. A decision tree with just two splits (discount and weight) lands in the same range, which explains the wall: delays follow two hard rules plus a lot of noise, so adding model complexity adds nothing. Landing on the same ceiling with five different approaches was the signal to stop tuning and start diagnosing.
Mapping the chaos in Power BI
With prediction capped, the next move is to map where delays concentrate and to test which factors really matter. Shipping mode, warehouse block, gender and customer rating show no meaningful difference (all within about 58–60%), so the dashboard doubles as evidence of where not to look.
The VIP Paradox
- "High importance" shipments were the most delayed. 65% late against 59% for the rest (statistically significant) — the deliveries that should get the most care were getting the least reliable treatment.
- A discount above 10% meant a late shipment, every time. All 2,647 shipments with a discount above 10% arrived late, and a weight between 2.5 and 3.5 kg behaved the same way (874 shipments). Together these two rules cover 2,776 shipments, 25% of the total, and account for 42% of all delays.
- Outside those rules, delays are close to a coin flip. The remaining 8,223 shipments are late about 46% of the time, with no variable in the data separating them well — which is why no model went past roughly 67% accuracy.
- Shipping mode and warehouse made no real difference. Flight 60.2%, ship 59.8%, road 58.8%; the five warehouse blocks range from 58.6% to 60.2%. These gaps are within chance (chi-square p = 0.69 for mode, 0.90 for warehouse), so the data does not point to air-freight carriers or to any single warehouse.
True analysis doesn't stop at model.fit() — it stops when the business makes a decision. Here, that meant redirecting effort away from a predictive algorithm and toward two concrete questions: why does every order discounted above 10% ship late (for example, are promotional orders routed through a slower fulfilment path?), and what happens to parcels between 2.5 and 3.5 kg? A 67% ceiling didn't fail to predict the future; it showed that the delays come from a process rule, not from the shipping mode or the warehouse.
Caveat: this is a public Kaggle dataset. Thresholds as exact as “100% late above a discount” are unusual in real operations, so the finding should be read as a property of this dataset and checked against real process data before acting on it.