I ordered a pizza from @zomato recently. I thought this feature was a simple implementation, but this shocked me when I got to know the reality.

A Thread 🧵

We as a species hate to wait. With this feature, @zomato answered an impatient question by most people, 'When will my food arrive?'

Yes, I am talking about the Food Preparation time that @zomato displays on their app after the user orders food.
I thought that this is something that the restaurant enters. But @zomato uses Machine Learning to predict this time!

I was amazed after knowing this, and here is how they implement this to achieve accurate results.
Let's consider you also order pizza like me from 2 different restaurants. @dominos and a local restaurant that has the pizza on their menu but not their specialty.
It's easy to guess that @dominos will make the pizza faster as it's their specialty and will have a dedicated kitchen capacity geared towards preparing pizzas.

But more factors are in play here like queued orders, fine dining restaurants vs delivery kitchens, opening hours, etc.
They divided these factors into two categories item-level information and restaurant-level information.

These categories are encoded using Word2Vec Embedding and Categorical Embedding, respectively.
The embedding matrix is our restaurant representation which is pass through the XGBoost regressor model.

Concurrently they passed both running orders and completed orders through a stacked LSTM layer.
The resulting vector is concatenated with the present order features and the Restaurant Embedding Vector.

The resulting vector after concatenation is pass through a two-layer dense network to get food preparation time.
The scale of business demands better Food Preparation Time prediction, which in turn helps in better delivery time, better allocation of Delivery Partners in order assignment, and efficient delivery of orders.
If you found this thread insightful please RT and like the thread. It motivates me to bring high-quality stuff and not post random things.

Consider following me for more insightful threads!

More from All

You May Also Like