iFood uses recommendation systems and machine learning models to improve the food delivery experience for customers. They generate word embeddings from text data to understand relationships between food items. A knowledge graph connects entities like users, restaurants, dishes and ingredients to enrich data. Graph convolutional networks are used to create embeddings that represent nodes based on their connections in the graph. These embeddings are used in recommendation systems at iFood to provide personalized search results, lists of similar items, and improve other machine learning models.
5. IFOOD IN NUMBERS
40 million orders
200k restaurants
150k drivers
1000 cities
*these numbers are only from Brazil
6. AN UNIQUE MOMENT - YOU CAN'T FAST-FORWARD OR SKIP
Time and Quality
Decision process
Special occasion
We are not a streaming service.
Ordering food has an additional
difficulty being assertive because
fixing a mistake is not like skipping a
media: placing an order involves more
money and logistical operation.
7. FOOD IS A VERY PERSONAL CHOICE
Taste Profile
Speed
Brand
Price Affinity
Offer Affinity
etc…
Taste Profile
Dish
Cuisine
Offers
Rating
etc…
Match
8. CHALLENGES
Locality geographical constraint for model training
Speed if you are hungry you will want to eat soon
Serviceability production capacity and restaurant quality
Feedback implicit (engagement) vs explicit (ratings)
Growth cold start problem
9. EVERYWHERE CAN BE PERSONALIZED
Push Notification
List of Restaurants
List of Dishes
Search Results
UI Components
10. PILLARS OF IFOOD 1:1
User Profile Which cuisine does she like most?
Context How would the offer change on weekends?
Journey If a user ordered "n" yesterday, what are the best "y" to offer today?
Dish Profile Healthy? Low-calorie? How allergy-risk?
12. ALS WITH MULTIPLE MATRICES
.9 .7
.5 .7
.5 .3
U1
U2
U3
Main Matrix
Customized
Discovery
The classic ALS approach (user x item
with implicit feedback) worked very
well for recurring users. The
conversion was not so good for users
without a long history of purchases or
for new items.
13. ALS WITH MULTIPLE MATRICES
.35 .50 .28
.29 .61 .32
.42 .18
C1
C2
C3
"Clusters" Matrix
Group of users
Implicit and explicit feedback
We can use any feature known to the
user or the item to make a hybrid
approach to content-based and
collaborative filtering. Not using the
user in the matrix index, the matrix
becomes less sparse.
14. CANDUNGA
.35 .32 .28
.29 .61 .32
.42 .18
C1
C2
C3
.9 .7
.5 .7
.5 .3
U1
U2
U3
features
- No limit on number of matrices
- Features from user, item or booth
- Added the feature layer
- Items can be stores or products
- Bayesian optimization to define the weight of each matrix
- NDCG for offline evaluation
15. before after
LUNCH LIST FOR LUIZ MENDES
Japanese
Healthy
In the old version of the list,
the top items were desserts
and junk food. Luiz prefers
japanese and healthy foods.
19. EMBEDDINGS
An embedding is a relatively low-dimensional space into which you can translate high-dimensional vectors.
The most known embeddings are word embeddings, that are build based on the position of the word in a text and
which words come before and after it.
to learn more: https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture
20. EMBEDDINGS IN IFOOD
food2vec search2vec*foodgraph
Text based - fasttext
Build with ifood text data
Text based - word2vec
Created based on search queries
and the chosen restaurant
Content and graph based
Created based on connections
and features
22. food2vec
Create word embeddings
Build with ifood text data
Use fasttext to have better out of the vocabulary embeddings
Text data is very food specific and contains misspellings
25. pasta related words
vegetarian related words
pizza related words
japanese cuisine
related words
Edamame is ingredient common in both japanese and
vegetarian dishes and it is the middle of the groups
food2vec
26. food2vec
Create dish embeddings
Use the weighted mean of the dish name and description words
Weight is based on IDF (inverse document frequency)
28. food2vec
Can be used to augment dish lists
Frango grelhado. Acompanha cuscuz
marroquino com alho poró e ervilhas e cenoura.
Filé de Saint Peter grelhado. Acompanha purê
de abóbora e legumes ao vapor (brócolis e
vagem).
Salada Caesar de salmão cru defumado
Hamburguer vegano + acompanhamento + mini
salada
Risoto integral de ervilha com shimeji e tofu.
Take an example list Find similar dishes for all example Merge all neighbours and sort by similarity
34. Movie
Rotten link: www.rotten...
Imdb link: www.imdb…
Liked by: 90%
Description: An orpha..
The Land Before Time
Don Bluth
Directed by
Lucasfilm
Produced by
Knowledge Graph
36. Food Delivery contains many entities: Users, Restaurants, Dishes, Ingredients, Delivery, Vendors...
Food Graph
CONTAINS
Subject
Object
Apple pie><CONTAINS><apple
37. User A Restaurant R
Tomatoes Chickpea Lettuce
ordered from
contains
Vegan
is
to from
Driver D
Food Graph
38. Data
Enrichment
Stream of “Enriched” data
Taxonomy
Normalized Dish Names
Serving Size
Meal Type
Ingredients
Weights, Volumes
Tags
...
FKG
“Better” Entity
Representations
RecSys
Marketing
Search
...
Fill in Missing
information by
Graph completion
* 33.7% of dishes have no description.
Food Graph
40. “You are the average of the five people you
spend the most time with.”
jim rohn
41. Food Graph Embeddings
PinSage - pinterest
Must
● use node features (excludes node2vec for example)
● be able to create embeddings for unseen nodes
● be scalable (millions of nodes and possibly billions of edges)
● tested on production somewhere
https://medium.com/pinterest-engineering/pinsage-a-new-graph-convolutional-neural-network-for-web-scale-recommender-systems-88795a107f48
43. Food Graph Embeddings
A
Localized convolution based on Random Walks
● Starting from A make random walks and get the most visited
nodes as neighbours
44. Food Graph Embeddings
A
Localized convolution based on Random Walks
● Starting from A make random walks and get the most visited
nodes as neighbours
● B, C and D - First Hop
A
B
C
F
E
D
45. Food Graph Embeddings
Localized convolution based on Random Walks
● Starting from A make random walks and get the most visited
nodes as neighbours
● B, C and D - First Hop
● For each neighbour repeat this
○ B -> A and C
○ C -> A, B, E, and F
○ D -> A
A
B
C
F
E
D
46. Food Graph Embeddings
Localized convolution based on Random Walks
● Starting from A make random walks and get the most visited
nodes as neighbours
● B, C and D - First Hop
● For each neighbour repeat this
○ B -> A and C
○ C -> A, B, E, and F
○ D -> A
How many hops?
Usually 2
A
B
C
F
E
D
47. Food Graph Embeddings
Localized convolution based on Random Walks
● Starting from A make random walks and get the most visited
nodes as neighbours
● B, C and D - First Hop
● For each neighbour repeat this
○ B -> A and C
○ C -> A, B, E, and F
○ D -> A
How many hops?
Usually 2, if you go to far you might find Kevin Bacon*, or use almost
the whole graph for one node
A
B
C
F
E
D
* https://en.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon
51. Food Graph Embeddings
AB C
F
E
D
A
C
A
A
BConvolve
1. Get the first representation of A and C
2. Pass through a convolution layer to create the second B representation
a. send neighbors through a dense neural network and then apply a
aggregator/pooling function (e.g., a element-wise mean or
weighted sum, denoted as γ )
Ɣ
C
A
B
B
Convolve
52. Food Graph Embeddings
AB C
F
E
D
A
C
A
A
BConvolve
1. The weights are shared between “same step” convolutions
Ɣ
C
A
B
B
Convolve
Convolve
Convolve
Convolve
w1
w1
w2
53. Food Graph Embeddings in iFood
PinSage algorithm uses a homogeneous graph, that is, all nodes are the same type.
To transpose this to iFood we created first a Bipartite Graph of users and dishes.
54. Food Graph Embeddings in iFood
PinSage algorithm uses a homogeneous graph, that is, all nodes are the same type.
To transpose this to iFood we created first a Bipartite Graph of users and dishes.
55. Food Graph Embeddings in iFood
PinSage algorithm uses a homogeneous graph, that is, all nodes are the same type.
To transpose this to iFood we created first a Bipartite Graph of users and dishes.
56. Food Graph Embeddings in iFood
PinSage algorithm uses a homogeneous graph, that is, all nodes are the same type.
To transpose this to iFood we created first a Bipartite Graph of users and dishes.
57. Food Graph Embeddings in iFood
PinSage algorithm uses a homogeneous graph, that is, all nodes are the same type.
To transpose this to iFood we created first a Bipartite Graph of users and dishes.
58. Food Graph Embeddings in iFood
We use food2vec embeddings, category, cuisine and many other features as input.
The result is an embedding that contains both content from itself and neighbours.
60. Embeddings in Recommendation
These embeddings can e will be used in many projects in iFood:
● Similarity based recommendation
● Improve search results
● As features for classification/regression models
● Features for recommendation algorithms
● Improve Lean to Rank models