Introduction
Knowing how long you'll wait at a restaurant is valuable information. Yelp's wait time prediction system provides real-time estimates using ML models trained on historical and live data.
Problem Definition
User Need
- "Should I go to this restaurant now?"
- "How busy will it be at 7 PM?"
- "Is this wait time normal?"
Prediction Task
Given:
- Restaurant characteristics
- Current time/day
- Historical patterns
- Live signals
Predict:
- Expected wait time
- Confidence interval
Data Sources
Static Features
- Restaurant type and size
- Location characteristics
- Historical average wait times
Dynamic Features
- Current time of day/week
- Weather conditions
- Local events
- Real-time check-ins
Model Architecture
Multi-Stage Approach
Input Features -> Base Prediction -> Adjustment Layer -> Final Estimate
| | | |
(static) (historical avg) (real-time) (calibrated)
Feature Engineering
features = {
# Time features
'hour_of_day': encode_cyclic(hour, 24),
'day_of_week': one_hot(day, 7),
# Historical features
'avg_wait_this_hour': historical_mean(restaurant, hour),
'std_wait_this_hour': historical_std(restaurant, hour),
# Real-time features
'recent_checkins': count_last_hour(restaurant),
'current_capacity': estimate_occupancy(restaurant)
}
Training Details
Data Collection
- Waitlist app data
- Check-in timestamps
- User-reported waits
Model Selection
Compared:
- Gradient boosting (XGBoost)
- Neural networks
- Time series models (Prophet)
Winner: XGBoost for interpretability and performance
Evaluation
- MAE: Mean Absolute Error
- Coverage: % within confidence interval
- Calibration: Predicted vs. actual distributions
Production System
Real-Time Updates
- New data ingested continuously
- Model features updated in real-time
- Predictions refresh on page load
Edge Cases
- New restaurants (use similar restaurant priors)
- Unusual events (increase uncertainty)
- Missing data (graceful degradation)
Results
- X minute average error on wait time
- Y% user satisfaction with estimates
- Z% increase in reservations through Yelp
Lessons Learned
- Real-time signals matter significantly
- Uncertainty estimates are valuable to users
- Historical patterns provide strong baselines
- User feedback improves predictions
Build real-time prediction systems with our practical ML courses.