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.
| Model | Validation MAE | Validation RMSE | Validation R² | Test MAE | Test RMSE | Test R² | Mean signed error |
|---|---|---|---|---|---|---|---|
| Median baseline | 7.77 | 9.71 | -0.021 | 7.30 | 9.17 | -0.008 | −0.81 min |
| Decision Tree | 6.25 | 7.84 | 0.335 | 6.11 | 7.64 | 0.301 | +0.14 min |
| XGBoost (selected) | 6.16 | 7.71 | 0.356 | 6.04 | 7.56 | 0.316 | +0.15 min |
Test MAE
Lower is better.
Test RMSE
Lower is better.
Test R²
Higher is better.
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) | Orders | Median baseline mean | Decision Tree mean | XGBoost mean |
|---|---|---|---|---|
| 10 | 91 | 25.0 | 20.7 | 20.1 |
| 11 | 92 | 25.0 | 21.9 | 21.1 |
| 12 | 92 | 25.0 | 22.6 | 22.1 |
| 13 | 85 | 25.0 | 22.8 | 22.8 |
| 14 | 84 | 25.0 | 22.4 | 22.2 |
| 15 | 229 | 25.0 | 23.7 | 23.7 |
| 16 | 206 | 25.0 | 23.2 | 23.3 |
| 17 | 223 | 25.0 | 23.8 | 23.8 |
| 18 | 234 | 25.0 | 23.8 | 23.9 |
| 19 | 234 | 25.0 | 23.4 | 23.5 |
| 20 | 201 | 25.0 | 24.5 | 24.6 |
| 21 | 177 | 25.0 | 24.5 | 24.6 |
| 22 | 199 | 25.0 | 25.2 | 25.2 |
| 23 | 227 | 25.0 | 24.9 | 24.9 |
| 24 | 208 | 25.0 | 24.3 | 24.4 |
| 25 | 284 | 25.0 | 25.7 | 25.8 |
| 26 | 238 | 25.0 | 25.5 | 25.6 |
| 27 | 251 | 25.0 | 25.9 | 26.0 |
| 28 | 244 | 25.0 | 25.8 | 25.8 |
| 29 | 213 | 25.0 | 25.3 | 25.4 |
| 30 | 157 | 25.0 | 27.5 | 27.5 |
| 31 | 143 | 25.0 | 27.3 | 27.2 |
| 32 | 132 | 25.0 | 27.5 | 27.5 |
| 33 | 147 | 25.0 | 27.4 | 27.4 |
| 34 | 132 | 25.0 | 27.2 | 27.1 |
| 35 | 94 | 25.0 | 29.0 | 28.9 |
| 36 | 93 | 25.0 | 29.2 | 29.2 |
| 37 | 89 | 25.0 | 29.1 | 29.0 |
| 38 | 85 | 25.0 | 29.8 | 29.7 |
| 39 | 91 | 25.0 | 28.8 | 28.8 |
| 40 | 51 | 25.0 | 31.0 | 31.0 |
| 41 | 64 | 25.0 | 31.9 | 31.9 |
| 42 | 75 | 25.0 | 31.8 | 31.6 |
| 43 | 53 | 25.0 | 31.4 | 31.2 |
| 44 | 55 | 25.0 | 34.2 | 34.3 |
| 45 | 21 | 25.0 | 36.2 | 35.8 |
| 46 | 30 | 25.0 | 33.8 | 34.6 |
| 47 | 41 | 25.0 | 34.8 | 35.0 |
| 48 | 26 | 25.0 | 33.4 | 34.9 |
| 49 | 29 | 25.0 | 35.6 | 35.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
Show the numbers
| Error (min) | Orders |
|---|---|
| -30 to -28 | 8 |
| -28 to -26 | 23 |
| -26 to -24 | 12 |
| -24 to -22 | 55 |
| -22 to -20 | 71 |
| -20 to -18 | 76 |
| -18 to -16 | 128 |
| -16 to -14 | 115 |
| -14 to -12 | 176 |
| -12 to -10 | 182 |
| -10 to -8 | 226 |
| -8 to -6 | 279 |
| -6 to -4 | 300 |
| -4 to -2 | 457 |
| -2 to 0 | 489 |
| 0 to 2 | 492 |
| 2 to 4 | 426 |
| 4 to 6 | 378 |
| 6 to 8 | 468 |
| 8 to 10 | 429 |
| 10 to 12 | 313 |
| 12 to 14 | 177 |
| 14 to 16 | 183 |
| 16 to 18 | 0 |
| 18 to 20 | 0 |
| 20 to 22 | 0 |
| 22 to 24 | 0 |
| 24 to 26 | 0 |
| 26 to 28 | 0 |
| 28 to 30 | 0 |
Decision Tree
Show the numbers
| Error (min) | Orders |
|---|---|
| -30 to -28 | 3 |
| -28 to -26 | 1 |
| -26 to -24 | 6 |
| -24 to -22 | 11 |
| -22 to -20 | 22 |
| -20 to -18 | 36 |
| -18 to -16 | 49 |
| -16 to -14 | 87 |
| -14 to -12 | 111 |
| -12 to -10 | 176 |
| -10 to -8 | 269 |
| -8 to -6 | 335 |
| -6 to -4 | 454 |
| -4 to -2 | 519 |
| -2 to 0 | 522 |
| 0 to 2 | 562 |
| 2 to 4 | 556 |
| 4 to 6 | 492 |
| 6 to 8 | 416 |
| 8 to 10 | 346 |
| 10 to 12 | 195 |
| 12 to 14 | 133 |
| 14 to 16 | 88 |
| 16 to 18 | 55 |
| 18 to 20 | 12 |
| 20 to 22 | 5 |
| 22 to 24 | 2 |
| 24 to 26 | 0 |
| 26 to 28 | 0 |
| 28 to 30 | 0 |
XGBoostSelected
Show the numbers
| Error (min) | Orders |
|---|---|
| -30 to -28 | 2 |
| -28 to -26 | 1 |
| -26 to -24 | 9 |
| -24 to -22 | 8 |
| -22 to -20 | 18 |
| -20 to -18 | 39 |
| -18 to -16 | 42 |
| -16 to -14 | 87 |
| -14 to -12 | 114 |
| -12 to -10 | 189 |
| -10 to -8 | 242 |
| -8 to -6 | 346 |
| -6 to -4 | 442 |
| -4 to -2 | 531 |
| -2 to 0 | 514 |
| 0 to 2 | 567 |
| 2 to 4 | 581 |
| 4 to 6 | 495 |
| 6 to 8 | 403 |
| 8 to 10 | 356 |
| 10 to 12 | 193 |
| 12 to 14 | 136 |
| 14 to 16 | 82 |
| 16 to 18 | 48 |
| 18 to 20 | 11 |
| 20 to 22 | 5 |
| 22 to 24 | 1 |
| 24 to 26 | 1 |
| 26 to 28 | 0 |
| 28 to 30 | 0 |
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 time | Orders | Median baseline | Decision Tree | XGBoost |
|---|---|---|---|---|
| 10–19 min | 1,570 | +9.4 min | +7.6 min | +7.5 min |
| 20–29 min | 2,242 | +0.3 min | +0.5 min | +0.6 min |
| 30–39 min | 1,163 | −8.9 min | −5.8 min | −5.9 min |
| 40–54 min | 488 | −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 time | Orders | Median baseline MAE | Decision Tree MAE | XGBoost MAE |
|---|---|---|---|---|
| 10–19 min | 1,570 | 9.4 min | 7.6 min | 7.5 min |
| 20–29 min | 2,242 | 2.4 min | 3.8 min | 3.7 min |
| 30–39 min | 1,163 | 8.9 min | 6.1 min | 6.1 min |
| 40–54 min | 488 | 19.4 min | 11.8 min | 11.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.