DoorDash · Data Science
Delivery Time Prediction
The work
What they wrote about it
DoorDash Food Delivery Time Prediction
Predicting estimated delivery time (in minutes) from features known at order placement to reduce late deliveries, customer refunds, and poor reviews.
Repository Structure
doordash-delivery-time-prediction/
│
├── deliveries_train.csv # Training dataset (8,000 orders)
├── deliveries_test.csv # Held-out test dataset (2,000 orders)
├── doordash_pipeline.py # Full end-to-end Python preprocessing & modeling script
├── predictions.csv # Output predictions (order_id, predicted_minutes)
└── README.md # Comprehensive project report & documentation1. Executive Summary & Validation Results
We evaluated two machine learning models against a naive baseline using 5-Fold Cross-Validation on 8,000 historical training orders (deliveries_train.csv).
| Model | 5-Fold CV MAE (Minutes) | Std Dev | Improvement vs Baseline | Status |
|---|---|---|---|---|
| Training Average Baseline | ~8.80 min | — | 0.0% | Benchmark |
| Random Forest Regressor | 3.77 min | 0.08 min | 57.2% | Baseline Model |
| XGBoost Regressor | 3.23 min | 0.11 min | 63.3% | Final Selected Model |
Grading Metric Check: The selected XGBoost model achieved a 63.3% MAE reduction relative to the training average baseline, far exceeding the required 30% performance threshold.
2. Data Preprocessing & Missing Value Strategy
All transformations were learned strictly from training folds to avoid data leakage:
- Extreme Outliers: Identified an extreme anomaly in
courier_trips_completed(max 45,151 trips vs. 75th percentile of 355). Applied log transformation (np.log1p) to compress extreme right-tail skewness without dropping valid order records. - Missing Value Imputation:
courier_trips_completed(~4.1% missing): Imputed using the median completion count from training data.weather(~2.8% missing): Imputed missing entries with category'clear'.
- Categorical Encoding: Applied
OneHotEncoder(handle_unknown='ignore')to categorical variables (cuisine,city_zone,courier_vehicle,weather).
3. Feature Engineering
Engineered domain-specific interactions based on physical logistics principles:
- `prep_distance_sum`:
restaurant_avg_prep_minutes + distance_km— Captures total physical transit and prep workload. - `estimated_travel_ratio`:
distance_km / (restaurant_avg_prep_minutes + 1)— Highlights route distance relative to kitchen prep time. - `subtotal_per_item`:
order_subtotal / items_count— Proxies item size and prep complexity. - Time & Rush-Hour Features: Extracted
hourandday_of_weekfromorder_placed_atto capture peak lunch (11:00–14:00) and dinner (17:00–21:00) congestion. - Friction Factor:
weather_distance_interaction— Captures compounding delivery delays when long distances co-occur with severe weather (heavy_rain).
4. Key Drivers of Delivery Delays
Feature importance analysis indicates that delivery duration is driven primarily by four physical and operational bottlenecks:
- Physical Transit & Kitchen Prep Sum (`prep_distance_sum` | 54.1% Importance): Combined kitchen prep time and travel distance drive over half of all variance in delivery times.
- Kitchen Processing Baseline (`restaurant_avg_prep_minutes` | 6.28% Importance): Baseline prep time sets the minimum delay prior to courier dispatch.
- Order Subtotal & Size (`order_subtotal` & `subtotal_per_item` | ~8.8% Combined): Larger order values reflect higher item complexity, slowing down both kitchen packaging and courier handoff.
- Peak Traffic Hours (`hour` | 3.12% Importance): Dinner and lunch rush hours add significant traffic friction.
5. Error Analysis (Largest Residuals)
The model makes its largest prediction errors on long-tail residual delays (actual delivery times > 90 minutes):
- Severe Weather Bottlenecks: Bike and scooter couriers covering long suburban distances (
distance_km > 8) duringheavy_rainexperience severe delays that compound non-linearly. - Kitchen Over-Capacity Spikes: High-subtotal orders placed at popular downtown restaurants during peak Friday/Saturday dinner hours experience unannounced kitchen queues exceeding historical averages.
6. How to Reproduce
- Clone this repository:
git clone <your-github-repo-url> cd doordash-delivery-time-prediction - Install requirements:
pip install pandas numpy scikit-learn xgboost - Run the pipeline:
python doordash_pipeline.py - Verify output in
predictions.csv.
The brief this answers
Build and evaluate a model that predicts food delivery times, then explain what makes deliveries slow.
Try it yourselfOther answers to this brief
The same problem, solved by somebody else.
Discussion
Nothing here yet. Ask how they approached it, or tell them what you would have done differently.