Launching Soon in USA | Launching Soon in Nigeria

Estimating Food Preparation Time Using Advanced Technology

Have you ever pondered why we, as humans, seem to be drawn to activities that can be completed quickly? Why do we keep instant noodles, instant coffee, and ready-to-eat prepared foods in our kitchens?
We, as a species, despise waiting. We feel the same is true when it comes to food. 'Where is my food?' and 'What happened to my food?' are two queries that come to mind frequently. or 'When will my meal be delivered?' It is critical for Touramp Food to offer accurate information on when a customer's meal will be delivered from the time they open the app until it reaches at their home.
Giving a time estimate that is greater than the real delivery time might dissuade consumers from buying, while giving a time estimate that is shorter than the actual delivery time can boost inflow to our customer care.
As a consequence, precise time prediction not only improves the client experience but also helps our customer care employees work more efficiently

What Happens When a Customer Places An Order?

As seen above, several handshakes occur in the food delivery ecosystem after a client puts an order
Each of these processes has a time component, such as the time it takes for the restaurant to cook the meal (Food Preparation Time, FPT), our Delivery Partner (DP) to arrive at the restaurant (DP pick up time), and our DP to arrive at the customer's address (DP delivery time) (DP drop time).
All of these, as well as a few additional (expected and unpredictable) time components, come together to calculate the time from order placing to final delivery, which is then displayed to our consumers.

Aahan Technologies

What is The Benefit Of An Improved Frequent Pattern Tree prediction?

Aahan Technologies

Tourampfood's online meal delivery network includes eateries in many cities across USA, serving 400+ cuisines, demonstrating that diversity can be found in every nook and cranny of the country.
The size of the company necessitates greater FPT projection, which aids in faster delivery times, better DP allocation in order assignment, and efficient order delivery. It also allows us to communicate more effectively with our Restaurant Partners in order to keep track of FPT violations and compliance

What Variables Influence FPT Forecasting?

The FPT for a given dish is influenced by a number of factors. Let's pretend a client buys Chicken Biryani (D1) from two different restaurants (R1 and R2) -

1. R1 is a Biryani restaurant that specialises in the dish.
2. R2 is a multi-cuisine restaurant that serves a variety of meals, including Biryani.

Given the identical circumstances, one would anticipate R1's FPT of Chicken Biryani to be lower than R2's because –

1. R1 is known for its Biryanis, thus one would anticipate its kitchen capacity and food preparations to be focused on making Biryanis. They may have also improved their technique to reduce the time it takes to prepare Biryani.
2. Because the same kitchen is used for different dish preparations, R2 caters to a wide range of food alternatives. As a result, it is unlikely to have methods optimized for a specific item.

However, there might be some other variables at work here —

Orders In Line

This is the number of orders that have already been placed for each restaurant. It's possible that one restaurant has a big line while the other has no customers.

Restaurants With Fine Dining vs. Delivery Kitchens

If one restaurant is a fine dining institution and the other is a delivery kitchen, the latter should expect a shorter FPT.

Opening Hours

This is the length of time that the restaurant has been available for delivery. Is it new or has it been there for some time? These are subtle indicators of whether or not the kitchen is operating at maximum capacity.

Other Items In Order

What are the other items in the order, in addition to the Chicken Biryani? Is it possible to prepare the things in parallel or would they have to be done in order? Do the separate items have a different FPT?

There are many components to remember!
How did we depict these elements?

We Split The Problem Into Two Primary Components Due to Its Nature -

Information at the item level, i.e. the order's item composition

1. As previously stated, various products would require varied amounts of time to prepare.
2. Orders for larger quantities may take a bit longer.

Information at the restaurant level, i.e., the fundamental features and nature of a restaurant in terms of food preparation time

1. Fast food or takeout Only eateries would behave differently from fine dining establishments

2. Each restaurant's cooking capacity varies

Encoding Information at the Item Level

We've noticed that the information at the item level is generally in text format. The most prevalent approaches for using text information in machine learning models are Bag-of-Words, Tf-Idf, and Word2Vec Embedding. Because they encode the information in a One Hot Encoding, the first two techniques fail at our size (this is a method where data is converted into forms that help better prediction). Given that our platform has 3.5 million different dishes, this would have resulted in millions of columns being added to our data. Tf-Idf suffers from the same problem.

Aahan Technologies

Tourampfood's online meal delivery network includes eateries in many cities across USA, serving 400+ cuisines, demonstrating that diversity can be found in every nook and cranny of the country.
The size of the company necessitates greater FPT projection, which aids in faster delivery times, better DP allocation in order assignment, and efficient order delivery. It also allows us to communicate more effectively with our Restaurant Partners in order to keep track of FPT violations and compliance

Those two techniques were abandoned because —

1. As the number of dishes grows, so does the amount of data collected (more number of new dishes are getting added to our platform every day).
2. High dimensionality - This would need a lot of storage and might cause latency concerns when providing models.
3. Following ML models will have sparsity concerns, making them less robust.

Word2Vec embedding became the preferable option for us because –

1. We were able to store item-level data in fewer RAM as a result of this.
2. It enables the model to understand how similar things behave in terms of cuisine and cooking method.

The visualisation and subsequent grouping of menu item vectors learned with Word2Vec are shown in the figure above. It's possible to watch how distinct clusters form. For example, all varieties of Biryanis are grouped together, while Milkshakes are not, which is to be expected given that they are essentially distinct meals
A single item is rarely seen in a single order. To arrive at the final menu representation, we take the quantity and cost weighted average of the item vector.

Coding Information at the Restaurant Level

Given that food is ordered from over 150k restaurants per month, figuring out how a restaurant may be quantitatively represented for a machine learning model becomes the most important piece of the puzzle.
Categorical data is used to represent a restaurant in our example. In business datasets, categorical data is frequent. Users are generally classified according to their country of origin, gender, age group, and other factors. Product types, manufacturers, and sellers are all used to characterise products
One Hot Encoding, Encoding Categories using Dataset Statistics, and Encoding Categories as Cluster Labels are the three most often used category representations

Due to the following reasons, categorical data is highly handy for understanding but quite difficult for most machine learning algorithms to understand —

1. High cardinality - categorical variables with a large number of levels (for example, city or restaurants) may only exist in a limited number of instances
2. Many machine learning models (such as SVM) are algebraic, requiring numerical input. Before we can use the learning process with these models, we must first convert the categories into numbers.

The core concept is that we let a neural network determine the optimal restaurant representation on its own. Entity embedding is the representation of an entity, which in this example is a restaurant, as a vector (a list of real values).

What Methods Did We Use to Hone Our Model?


We acquire the final restaurant representation through the embedding matrix, and then we feed the same X-Vector to an XGBoost Regressor Model as in the entity embedding architecture

Architecture for Deep Learning

Our old model design was unable to account for the past sequences of orders that had arrived at the restaurant, both finished and ongoing orders. If there was an order of Butter Chicken in the list of "previously completed orders," one would anticipate the FPT of a Butter Chicken order to be close to the prior figure. By presenting facts in a logical order, you will have a better understanding of the kitchen's capacity and behaviour at time.
A restaurant's FPT may also be thought of as a time series with varying amplitudes (denoting FPT of the order) depending on the item being cooked. As a result, we decided to use a sequential architecture to better portray the kitchen of a restaurant.
A stacked LSTM Layer is used to pass both running orders (at time T, up to 5 running orders) and completed orders (last 5 completed orders). The current order characteristics and the Restaurant Embedding Vector are concatenated with the resultant column vector

Aahan Technologies

Next Steps and Improvements to Our Model

We were also able to improve the model by adding a restaurant level information input of preparation time, in addition to the encoding of data across restaurants and meals.
The discrepancy between the restaurant accepted order timestamp and the DP order pick up timestamp was formerly utilised to compute FPT. This didn't result in genuine FPT since the behaviour of a specific DP during order pick-up was factored in. As FPT is a restaurant phenomenon, this shouldn't be the case. We added a Food Order Ready (FOR) button to the Restaurant Partner app to address this.
They may now use this to indicate when the food items are ready to be picked up. We noticed a 9 percent boost in prediction accuracy within 5 minutes in our early results. Our forecast findings get increasingly more accurate as FOR compliance rises.
We're also heading toward the newest and most interesting paradigm in data science: Reinforcement Learning, which is a self-learning system that adjusts weights in response to real-time mistakes seen at the restaurant level. Given that food preparation time represents real-time behavior, creating such a system will be a more elegant solution to this issue statement, guaranteeing that our clients have a more pleasant order tracking experience.