Akeed Restaurant Recommendation
This competition is hosted on Zindi, a machine learning platform for data science challenges.
TL;DR: When interaction data is sparse but spatial data is rich, reframe recommendation as a geographic segmentation problem. Cluster the supply side spatially, segment the demand side behaviorally, and let peer behavior within each zone drive the recommendations. Simple proximity-weighted frequency scoring can outperform complex algorithms when it aligns with the true data-generating process.
The Problem
The task seemed like a classic recommendation problem: given 100 restaurants and thousands of customers, predict which restaurant each customer will order from next. Most teams on the leaderboard reached for collaborative filtering — user-item matrices, embedding distances, factorization machines. That's the textbook approach when you have rich interaction history.
But the data told a different story. Most customers had ordered from only one or two restaurants. The interaction matrix was almost entirely zeros. Collaborative filtering needs density to find patterns, and this dataset had almost none. What the data did have was geography — precise coordinates for every customer location and every vendor. And in food delivery, geography is destiny. Nobody orders from a restaurant 30 kilometers away, regardless of how good the reviews are.
The real question wasn't "which restaurants does this customer like?" — it was "which nearby restaurants do people like this customer tend to order from?" That reframing changed everything about how I designed the solution.
My Approach
I abandoned collaborative filtering entirely and built what I call a geography-first segmented recommendation engine. The core idea: if I know where you are, what demographic segment you belong to, and which restaurants are nearby, I can predict your order by looking at what similar people in your area actually ordered. No embeddings needed. No neural networks. Just spatial proximity within behavioral segments.
First, I clustered all 100 vendors into 4 geographic zones using K-Means on their coordinates. This created the spatial constraint — a customer in Zone 1 won't order from a Zone 4 vendor. Then I segmented customers into 18 groups based on gender, number of delivery locations, and account age. A new male user with one address behaves fundamentally differently from a long-tenured female with multiple delivery locations. These aren't arbitrary segments — they capture real behavioral differences in ordering patterns.
The recommendation itself is elegantly simple: for each test customer, find their segment and zone, look at what train customers in the same segment and zone actually ordered, and score vendors by frequency divided by Manhattan distance. The closer and more popular a vendor is within your peer group, the higher it scores. This approach leverages the strongest signal in the data (proximity) while accounting for preference heterogeneity (segments).
I also grouped the original 50+ vendor cuisine tags into 8 meaningful categories — Arabic, Indian, International, Desserts, Drinks, Sandwiches, Breakfast, Others — making vendor profiles comparable across the recommendation engine. The final pipeline runs in pure R with data.table for performance, producing recommendations for all 10,000 test customers in seconds.
Key Decisions
Geography Over Collaborative Filtering
With only 100 vendors and most customers having 1-2 orders, the interaction matrix is too sparse for CF to work. The dominant signal is spatial proximity within a demographic segment, not user-item similarity. Recognizing which signal is strongest in the data — and building around it — is more important than applying sophisticated algorithms to weak signals.
Vendor Geographic Zones via K-Means
Clustering vendors into 4 spatial zones creates a hard delivery-radius constraint. This reflects the physical reality of food delivery: customers only order from nearby vendors. The zones become the first filter, immediately eliminating 75% of irrelevant vendor-customer pairs before scoring even begins.
18-Segment Customer Grouping
Gender × location count × account tenure creates segments that capture real behavioral variation. This isn't segmentation for its own sake — each segment has measurably different ordering patterns. The segmentation ensures that recommendations reflect peer behavior rather than population averages.
Frequency-Distance Scoring
Scoring vendors as frequency divided by Manhattan distance balances popularity with proximity. A very popular restaurant slightly further away can still beat a mediocre one that's closer. This simple scoring function outperformed more complex approaches because it directly encodes the two signals that matter most.
Key Takeaway
The strongest lesson from this project is that problem framing matters more than algorithm sophistication. By recognizing that this was fundamentally a geography problem dressed up as a recommendation problem, I avoided fighting sparse data with powerful but inappropriate tools. The solution is simple, interpretable, fast, and effective — precisely because it's built around the dominant signal in the data rather than the default algorithmic paradigm for the problem category.
Design insight: When interaction data is sparse but spatial data is rich, reframe recommendation as a geographic segmentation problem. Cluster the supply side spatially, segment the demand side behaviorally, and let peer behavior within each zone drive the recommendations. Simple proximity-weighted frequency scoring can outperform complex algorithms when it aligns with the true data-generating process.
FAQ
What is the key takeaway from "Akeed Restaurant Recommendation"?
When interaction data is sparse but spatial data is rich, reframe recommendation as a geographic segmentation problem. Cluster the supply side spatially, segment the demand side behaviorally, and let peer behavior within each zone drive the recommendations. Simple proximity-weighted frequency scoring can outperform complex algorithms when it aligns with the true data-generating process.
Who wrote this and what is it about?
This was written by Mahmoud Trigui, Senior Data Scientist. Building a recommendation engine to predict restaurant orders using Arabic NLP and order pattern features. Ranked Top 45% (242/1249 competitors) on Zindi, August 2020.