2. Exploratory analysis
What drives delivery time
Before training, we looked at how delivery time varies with each column. The question for each one: does it change delivery time, and is it known at the moment the customer orders?
Only order-time information can be a model input
Weather, traffic, the rider's age, rating and vehicle, and how many orders the rider carries are all in the dataset, and several of them matter. But they're recorded during the delivery or depend on which rider takes the order, so the app can't know them when the customer orders. Training on them would make the test scores look better than the app could ever be. They're marked Not used below.
Delivery timeTarget
How long each of the 45,584 orders took, in whole minutes.
Most orders take 19 to 32 minutes. The median is 26 minutes and the mean 26.3. Times range from 10 to 54 minutes with a long right tail.
Show the numbers
| Minutes | Orders |
|---|---|
| 10 | 750 |
| 11 | 757 |
| 12 | 746 |
| 13 | 716 |
| 14 | 739 |
| 15 | 1,810 |
| 16 | 1,706 |
| 17 | 1,696 |
| 18 | 1,765 |
| 19 | 1,824 |
| 20 | 1,640 |
| 21 | 1,600 |
| 22 | 1,626 |
| 23 | 1,643 |
| 24 | 1,679 |
| 25 | 2,050 |
| 26 | 2,121 |
| 27 | 1,976 |
| 28 | 1,965 |
| 29 | 1,956 |
| 30 | 1,217 |
| 31 | 1,213 |
| 32 | 1,123 |
| 33 | 1,258 |
| 34 | 1,171 |
| 35 | 832 |
| 36 | 852 |
| 37 | 828 |
| 38 | 887 |
| 39 | 847 |
| 40 | 554 |
| 41 | 553 |
| 42 | 561 |
| 43 | 567 |
| 44 | 553 |
| 45 | 241 |
| 46 | 274 |
| 47 | 295 |
| 48 | 277 |
| 49 | 280 |
| 50 | 72 |
| 51 | 94 |
| 52 | 79 |
| 53 | 100 |
| 54 | 91 |
By hour of the orderModel input
Average delivery time for orders placed in each hour. No orders were placed between 1 AM and 8 AM.
The hour matters a lot: about 20 minutes for orders from 8 to 10 AM, about 31 minutes from 7 to 9 PM, and about 23 minutes late at night. Shuffling this input hurts the model more than any other.
Show the numbers
| Hour | Orders | Mean (min) |
|---|---|---|
| 8 AM | 1,817 | 19.6 |
| 9 AM | 1,947 | 19.5 |
| 10 AM | 1,991 | 19.5 |
| 11 AM | 1,961 | 26.4 |
| 12 PM | 892 | 26.8 |
| 1 PM | 783 | 27.5 |
| 2 PM | 791 | 27.5 |
| 3 PM | 873 | 23.2 |
| 4 PM | 709 | 22.9 |
| 5 PM | 4,277 | 27.4 |
| 6 PM | 4,479 | 27.3 |
| 7 PM | 4,593 | 30.8 |
| 8 PM | 4,538 | 31.2 |
| 9 PM | 4,685 | 31.1 |
| 10 PM | 4,576 | 23.2 |
| 11 PM | 4,511 | 22.5 |
| 12 AM | 430 | 22.2 |
By day of the weekModel input
Average delivery time for orders placed on each day.
Every day averages between 25 and 28 minutes. The day matters much less than the hour.
Show the numbers
| Day | Orders | Mean (min) |
|---|---|---|
| Monday | 5,972 | 26.3 |
| Tuesday | 6,097 | 25.3 |
| Wednesday | 6,802 | 27.7 |
| Thursday | 6,120 | 25.2 |
| Friday | 6,766 | 26.8 |
| Saturday | 6,084 | 26.1 |
| Sunday | 6,012 | 26.4 |
Delivery time by category
Each box covers the middle half of orders, the line inside is the median, and the whiskers reach the furthest order within 1.5 times the box's width. Hover a row for the numbers.
Order typeModel input
All four order types take about the same time, so the model gets little from this input.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| snack | 11,530 | 26 | 26.3 |
| meal | 11,456 | 26 | 26.4 |
| drinks | 11,321 | 25 | 26.2 |
| buffet | 11,277 | 26 | 26.3 |
FestivalModel input
Festival orders take much longer, about 45 minutes against 26. Few orders are festivals, but the effect is large.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| no | 44,460 | 25 | 26.0 |
| yes | 896 | 45 | 45.5 |
| missing | 228 | 11 | 11.2 |
City typeModel input
Semi-urban orders take far longer. Metropolitan orders take a few minutes longer than urban ones.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| Semi-Urban | 164 | 49 | 49.7 |
| Urban | 10,133 | 22 | 23.0 |
| Metropolitan | 34,087 | 26 | 27.3 |
| missing | 1,200 | 21 | 22.1 |
WeatherNot used
Sunny days are fastest. Weather is recorded during the delivery, so the app can't know it when you order.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| sunny | 7,282 | 20 | 21.9 |
| cloudy | 7,533 | 28 | 28.9 |
| windy | 7,422 | 26 | 26.1 |
| fog | 7,653 | 28 | 28.9 |
| stormy | 7,584 | 26 | 25.9 |
| sandstorms | 7,494 | 26 | 25.9 |
| missing | 616 | 26 | 26.5 |
Traffic densityNot used
Traffic jams add about 10 minutes. Traffic is also recorded during the delivery, so it isn't a model input.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| low | 15,476 | 20 | 21.3 |
| medium | 10,945 | 27 | 26.7 |
| high | 4,423 | 27 | 27.2 |
| jam | 14,139 | 31 | 31.2 |
| missing | 601 | 26 | 26.5 |
Multiple deliveriesNot used
Riders carrying 2 or 3 orders are much slower. This depends on rider assignment after the order.
Show the numbers
| Value | Orders | Median | Mean |
|---|---|---|---|
| 0 | 14,094 | 22 | 22.9 |
| 1 | 28,151 | 26 | 26.9 |
| 2 | 1,985 | 40 | 40.5 |
| 3 | 361 | 48 | 47.8 |
| missing | 993 | 21 | 22.8 |
Road distance and delivery timeModel input
A sample of 1,497 of the 37,700 orders with a road distance. The line is the average for each 2 km band, and the shaded area covers the middle half of orders in that band.
- Average
- Orders (sample)
Longer routes take longer, but only up to a point: about 21 minutes under 4 km, rising to about 30 minutes at 16 km, then flat. The correlation is 0.31, so distance explains only part of the variation.
Show the numbers
| Road distance | Orders | Mean (min) |
|---|---|---|
| 0–2 km | 556 | 21.1 |
| 2–4 km | 3,552 | 21.5 |
| 4–6 km | 3,595 | 21.9 |
| 6–8 km | 3,552 | 23.9 |
| 8–10 km | 3,614 | 24.6 |
| 10–12 km | 3,067 | 24.4 |
| 12–14 km | 3,232 | 25.6 |
| 14–16 km | 3,415 | 27.9 |
| 16–18 km | 3,285 | 29.4 |
| 18–20 km | 2,455 | 29.7 |
| 20–22 km | 1,900 | 29.7 |
| 22–24 km | 1,180 | 29.3 |
| 24–26 km | 1,501 | 29.9 |
| 26–28 km | 1,066 | 29.7 |
| 28–30 km | 612 | 29.7 |
| 30–32 km | 503 | 30.6 |
| 32–34 km | 212 | 30.7 |
| 34–36 km | 124 | 30.2 |
| 36–38 km | 82 | 29.8 |
| 38–40 km | 111 | 29.7 |
Missing values
Empty values per column in the raw CSV and after cleaning. Columns with none are left out.
- In the CSV
- After cleaning
Road distance is missing most often, because some coordinates are invalid and some points are too far from a road. Rows without it are left out of training. Missing city and festival values are kept and filled with “unknown”.
Show the numbers
| Column | In the CSV | After cleaning |
|---|---|---|
| Road distance (km) | — | 7,884 |
| Restaurant location (0, 0) | 3,640 | 3,640 |
| Rider rating | 1,908 | 1,961 |
| Rider age | 1,854 | 1,854 |
| Order time | 1,731 | 1,731 |
| City type | 1,200 | 1,200 |
| Multiple deliveries | 993 | 993 |
| Weather | 616 | 616 |
| Traffic density | 601 | 601 |
| Festival | 228 | 228 |
Correlation with delivery time
Pearson correlation of each numeric column with delivery time. Blue bars rise with delivery time, red bars fall.
The strongest numeric signals, multiple deliveries and rider rating, aren't known at order time. Road distance is the strongest one the app can use.
Show the numbers
| Column | Pearson | Spearman | Orders |
|---|---|---|---|
| Multiple deliveries | 0.387 | 0.339 | 44,591 |
| Rider rating | -0.341 | -0.294 | 43,623 |
| Straight-line distance (km) | 0.321 | 0.320 | 41,513 |
| Road distance (km) | 0.307 | 0.317 | 37,700 |
| Rider age | 0.300 | 0.312 | 43,730 |
| Route drive time (min) | 0.293 | 0.301 | 37,700 |
| Vehicle condition | -0.234 | -0.222 | 45,584 |
| Order hour | 0.184 | 0.101 | 43,853 |
| Day of week | 0.006 | 0.006 | 43,853 |