6. Evaluation

How the models compare

All three models were refitted on training and validation orders, then scored once on the 5,463 newest orders. XGBoost is about 1.3 minutes per order better than predicting the median for everyone, and slightly better than a single Decision Tree.

The scores

  • MAE: Mean absolute error: on average, how many minutes the prediction is off.
  • RMSE: Root mean squared error: like MAE, but big misses count for more.
  • R²: Share of the variation in delivery time the model explains. 0 is no better than the average, 1 is perfect.
ModelValidation MAEValidation RMSEValidation R²Test MAETest RMSETest R²Mean signed error
Median baseline7.779.71-0.0217.309.17-0.008−0.81 min
Decision Tree6.257.840.3356.117.640.301+0.14 min
XGBoost (selected)6.167.710.3566.047.560.316+0.15 min

Test MAE

Lower is better.

Median baseline
7.30 min
Decision Tree
6.11 min
XGBoost
6.04 min

Test RMSE

Lower is better.

Median baseline
9.17 min
Decision Tree
7.64 min
XGBoost
7.56 min

Test R²

Higher is better.

Median baseline
0.000
Decision Tree
0.301
XGBoost
0.316

The baseline's R² is slightly below zero (-0.008), drawn as zero above, because the median of older orders isn't quite the average of the test orders. Mean signed error is the average of predicted minus actual: XGBoost's +0.15 min means it's almost unbiased overall.

Predicted against actual delivery time

For each actual delivery time, the average prediction of each model. The shaded band covers the middle 80% of the selected model's predictions. Points on the dashed line would be perfect.

  • Median baseline
  • Decision Tree
  • XGBoost

All three models pull toward the middle. XGBoost overestimates short deliveries by about 7.5 min and underestimates the longest ones by about 11.0 min. The inputs don't explain why one order takes 15 minutes and a similar one takes 45.

Show the numbers
Actual (min)OrdersMedian baseline meanDecision Tree meanXGBoost mean
109125.020.720.1
119225.021.921.1
129225.022.622.1
138525.022.822.8
148425.022.422.2
1522925.023.723.7
1620625.023.223.3
1722325.023.823.8
1823425.023.823.9
1923425.023.423.5
2020125.024.524.6
2117725.024.524.6
2219925.025.225.2
2322725.024.924.9
2420825.024.324.4
2528425.025.725.8
2623825.025.525.6
2725125.025.926.0
2824425.025.825.8
2921325.025.325.4
3015725.027.527.5
3114325.027.327.2
3213225.027.527.5
3314725.027.427.4
3413225.027.227.1
359425.029.028.9
369325.029.229.2
378925.029.129.0
388525.029.829.7
399125.028.828.8
405125.031.031.0
416425.031.931.9
427525.031.831.6
435325.031.431.2
445525.034.234.3
452125.036.235.8
463025.033.834.6
474125.034.835.0
482625.033.434.9
492925.035.635.9

Prediction errors

Predicted minus actual minutes for every test order, in 2-minute bins. Left of zero is too early, right of zero is too late. All three charts share one scale.

Median baseline

-30-20-1001020
Show the numbers
Error (min)Orders
-30 to -288
-28 to -2623
-26 to -2412
-24 to -2255
-22 to -2071
-20 to -1876
-18 to -16128
-16 to -14115
-14 to -12176
-12 to -10182
-10 to -8226
-8 to -6279
-6 to -4300
-4 to -2457
-2 to 0489
0 to 2492
2 to 4426
4 to 6378
6 to 8468
8 to 10429
10 to 12313
12 to 14177
14 to 16183
16 to 180
18 to 200
20 to 220
22 to 240
24 to 260
26 to 280
28 to 300

Decision Tree

-30-20-1001020
Show the numbers
Error (min)Orders
-30 to -283
-28 to -261
-26 to -246
-24 to -2211
-22 to -2022
-20 to -1836
-18 to -1649
-16 to -1487
-14 to -12111
-12 to -10176
-10 to -8269
-8 to -6335
-6 to -4454
-4 to -2519
-2 to 0522
0 to 2562
2 to 4556
4 to 6492
6 to 8416
8 to 10346
10 to 12195
12 to 14133
14 to 1688
16 to 1855
18 to 2012
20 to 225
22 to 242
24 to 260
26 to 280
28 to 300

XGBoostSelected

-30-20-1001020
Show the numbers
Error (min)Orders
-30 to -282
-28 to -261
-26 to -249
-24 to -228
-22 to -2018
-20 to -1839
-18 to -1642
-16 to -1487
-14 to -12114
-12 to -10189
-10 to -8242
-8 to -6346
-6 to -4442
-4 to -2531
-2 to 0514
0 to 2567
2 to 4581
4 to 6495
6 to 8403
8 to 10356
10 to 12193
12 to 14136
14 to 1682
16 to 1848
18 to 2011
20 to 225
22 to 241
24 to 261
26 to 280
28 to 300

Error by actual delivery time

Average error, predicted minus actual, for test orders grouped by how long they really took. A negative error means the prediction was too early.

Actual timeOrdersMedian baselineDecision TreeXGBoost
10–19 min1,570+9.4 min+7.6 min+7.5 min
20–29 min2,242+0.3 min+0.5 min+0.6 min
30–39 min1,163−8.9 min−5.8 min−5.9 min
40–54 min488−19.4 min−11.2 min−11.0 min

The 488 orders that took 40–54 min are where the models struggle most: XGBoost is about 11 minutes too early on average.

Show the numbers
Actual timeOrdersMedian baseline MAEDecision Tree MAEXGBoost MAE
10–19 min1,5709.4 min7.6 min7.5 min
20–29 min2,2422.4 min3.8 min3.7 min
30–39 min1,1638.9 min6.1 min6.1 min
40–54 min48819.4 min11.8 min11.7 min

Honest limits

  • An R² of 0.32 leaves most of the variation unexplained. Weather, traffic and how many orders the rider carries explain a lot of it, but they aren't known when the customer orders, so the model can't use them.
  • Long deliveries are underestimated. A customer would rather be told 45 minutes and get the food in 35 than the reverse. A future version could predict a range or a high percentile instead of the average.
  • The data is from 2022 and covers 45,584 orders in Indian cities. The demo's restaurants and map are in Bengaluru, which has orders in the dataset, but the model learned from every city together.
  • Road distances are from today's map. OSRM routes use current OpenStreetMap roads, not the roads of 2022.

Where predictions are reliable

The training orders cover road distances from 1.49 to 39.51 km, ordered from 8 AM to midnight (17 distinct hours). The app warns outside those ranges, declines deliveries under 0.1 km or over 40 km by road, and treats a pin more than 500 m from a road as having no route.

What the running API serves now