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.

101520253035404550

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
MinutesOrders
10750
11757
12746
13716
14739
151,810
161,706
171,696
181,765
191,824
201,640
211,600
221,626
231,643
241,679
252,050
262,121
271,976
281,965
291,956
301,217
311,213
321,123
331,258
341,171
35832
36852
37828
38887
39847
40554
41553
42561
43567
44553
45241
46274
47295
48277
49280
5072
5194
5279
53100
5491

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.

8AM11AM2PM5PM8PM11PM

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
HourOrdersMean (min)
8 AM1,81719.6
9 AM1,94719.5
10 AM1,99119.5
11 AM1,96126.4
12 PM89226.8
1 PM78327.5
2 PM79127.5
3 PM87323.2
4 PM70922.9
5 PM4,27727.4
6 PM4,47927.3
7 PM4,59330.8
8 PM4,53831.2
9 PM4,68531.1
10 PM4,57623.2
11 PM4,51122.5
12 AM43022.2

By day of the weekModel input

Average delivery time for orders placed on each day.

MonTueWedThuFriSatSun

Every day averages between 25 and 28 minutes. The day matters much less than the hour.

Show the numbers
DayOrdersMean (min)
Monday5,97226.3
Tuesday6,09725.3
Wednesday6,80227.7
Thursday6,12025.2
Friday6,76626.8
Saturday6,08426.1
Sunday6,01226.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

snackmealdrinksbuffet

All four order types take about the same time, so the model gets little from this input.

Show the numbers
ValueOrdersMedianMean
snack11,5302626.3
meal11,4562626.4
drinks11,3212526.2
buffet11,2772626.3

FestivalModel input

noyesmissing

Festival orders take much longer, about 45 minutes against 26. Few orders are festivals, but the effect is large.

Show the numbers
ValueOrdersMedianMean
no44,4602526.0
yes8964545.5
missing2281111.2

City typeModel input

Semi-UrbanUrbanMetropolitanmissing

Semi-urban orders take far longer. Metropolitan orders take a few minutes longer than urban ones.

Show the numbers
ValueOrdersMedianMean
Semi-Urban1644949.7
Urban10,1332223.0
Metropolitan34,0872627.3
missing1,2002122.1

WeatherNot used

sunnycloudywindyfogstormysandstormsmissing

Sunny days are fastest. Weather is recorded during the delivery, so the app can't know it when you order.

Show the numbers
ValueOrdersMedianMean
sunny7,2822021.9
cloudy7,5332828.9
windy7,4222626.1
fog7,6532828.9
stormy7,5842625.9
sandstorms7,4942625.9
missing6162626.5

Traffic densityNot used

lowmediumhighjammissing

Traffic jams add about 10 minutes. Traffic is also recorded during the delivery, so it isn't a model input.

Show the numbers
ValueOrdersMedianMean
low15,4762021.3
medium10,9452726.7
high4,4232727.2
jam14,1393131.2
missing6012626.5

Multiple deliveriesNot used

0123missing

Riders carrying 2 or 3 orders are much slower. This depends on rider assignment after the order.

Show the numbers
ValueOrdersMedianMean
014,0942222.9
128,1512626.9
21,9854040.5
33614847.8
missing9932122.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 distanceOrdersMean (min)
0–2 km55621.1
2–4 km3,55221.5
4–6 km3,59521.9
6–8 km3,55223.9
8–10 km3,61424.6
10–12 km3,06724.4
12–14 km3,23225.6
14–16 km3,41527.9
16–18 km3,28529.4
18–20 km2,45529.7
20–22 km1,90029.7
22–24 km1,18029.3
24–26 km1,50129.9
26–28 km1,06629.7
28–30 km61229.7
30–32 km50330.6
32–34 km21230.7
34–36 km12430.2
36–38 km8229.8
38–40 km11129.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 (km)Model input
Not recorded
7,884
Restaurant location (0, 0)Model input
3,640
3,640
Rider rating
1,908
1,961
Rider age
1,854
1,854
Order timeModel input
1,731
1,731
City typeModel input
1,200
1,200
Multiple deliveries
993
993
Weather
616
616
Traffic density
601
601
FestivalModel input
228
228

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
ColumnIn the CSVAfter cleaning
Road distance (km)—7,884
Restaurant location (0, 0)3,6403,640
Rider rating1,9081,961
Rider age1,8541,854
Order time1,7311,731
City type1,2001,200
Multiple deliveries993993
Weather616616
Traffic density601601
Festival228228

Correlation with delivery time

Pearson correlation of each numeric column with delivery time. Blue bars rise with delivery time, red bars fall.

Multiple deliveries
+0.39
Rider rating
−0.34
Straight-line distance (km)
+0.32
Road distance (km)Model input
+0.31
Rider age
+0.30
Route drive time (min)
+0.29
Vehicle condition
−0.23
Order hourModel input
+0.18
Day of weekModel input
+0.01

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
ColumnPearsonSpearmanOrders
Multiple deliveries0.3870.33944,591
Rider rating-0.341-0.29443,623
Straight-line distance (km)0.3210.32041,513
Road distance (km)0.3070.31737,700
Rider age0.3000.31243,730
Route drive time (min)0.2930.30137,700
Vehicle condition-0.234-0.22245,584
Order hour0.1840.10143,853
Day of week0.0060.00643,853