<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ammar Zaher on Medium]]></title>
        <description><![CDATA[Stories by Ammar Zaher on Medium]]></description>
        <link>https://medium.com/@ammarzaher3?source=rss-ec18ad2438c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*12HHduz1aoDH4KTik8oulg.jpeg</url>
            <title>Stories by Ammar Zaher on Medium</title>
            <link>https://medium.com/@ammarzaher3?source=rss-ec18ad2438c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:35:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ammarzaher3/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Personalising Cooking Inspiration with Machine Learning at Cookpad]]></title>
            <link>https://sourcediving.com/personalising-cooking-inspiration-with-machine-learning-at-cookpad-f7eff5921a88?source=rss-ec18ad2438c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7eff5921a88</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[reranking]]></category>
            <dc:creator><![CDATA[Ammar Zaher]]></dc:creator>
            <pubDate>Fri, 01 Oct 2021 10:45:48 GMT</pubDate>
            <atom:updated>2021-10-01T17:34:14.426Z</atom:updated>
            <content:encoded><![CDATA[<p>As the Cookpad recipe service grows to serve more than 100 million people worldwide, with thousands of new recipes being published by our Authors (Cookpad’s content creators) each day, we are constantly seeking to improve how we determine which recipes to put in front of our users. Our intention is to help them find the recipes that they might like with considerably less effort. People come to Cookpad to help them solve the question of <em>what should I cook?</em>, and in some cases, users may not know exactly what they are looking for and are instead looking for some inspiration.</p><p>At Cookpad, a big part of our focus goes towards answering this question. The Cookpad Inspiration-Feed is the space that hosts all of the newly published recipes created by Authors from a particular region outside of a user’s immediate follow network. We know that some of our users come to the platform in search of new ideas and the Inspiration-Feed is designed precisely for this. It also serves to provide ongoing exposure to our Authors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*K0ueOZFIZF7i9Tug1xEFgw.jpeg" /><figcaption>Figure 1: The Cookpad Inspiration-Feed.</figcaption></figure><p>Up until recently, Cookpad’s strategy has been to update the Inspiration-Feed with new content using a recency-based approach. The main purpose behind this was to support our Authors, providing them (and their recipes) with the highest possible opportunity for exposure to receive feedback on their efforts. Gaining quick exposure is an extremely important factor, as the recipes published are the fuel for our platform. As our platform gains in popularity however, particularly in our more active regions, the number of new recipes being published on any given day is now too large to practically consume. The ML team aims to capitalise on the value machine learning can bring to this use-case, so that our users can go from inspiration to cooking more seamlessly. To this end, we have been working on personalising the Inspiration-Feed to solve this challenge of supply and demand by both providing exposure for Authors, and matching this to the most appropriate audiences that are likely to engage with and express interest in those recipes.</p><p>The purpose of this blog is to give a high level overview of our approach and journey to launching and scaling our first machine learning powered personalisation system. So, without further ado, let’s dive into some of the details.</p><h3>How do we implicitly learn from our user’s behaviours?</h3><p>For any personalisation system to work effectively, you must first identify and extract how to best represent users’ preferences or tastes. At Cookpad, there are different types of engagements and interactions that users make when using the platform. These interactions allow us to implicitly learn about their interests and tastes. The most relevant of these signals have been dubbed by the ML Team as ‘Cookability’ signals. For example, there is the <em>Cooksnap</em> — where the user uploads a screenshot of their completed version of a previously published recipe. Other examples include <em>saving a recipe</em> and <em>revisiting</em> <em>a recipe</em> across different days and finally, taking a <em>screenshot</em> of a recipe to save for later. Each of these interactions serves as a signal of intent or interest in a particular recipe. We use these signals as well as more traditional click signals (in an anonymised manner) to understand what our users are interested in.</p><h3>A brief overview of modelling and deployment</h3><p>Given the task at hand, personalising the Inspiration-Feed can therefore be framed as a ranking problem. By carrying out this personalised re-ranking on only the newly published recipes each day, we can also effectively balance our Authors’ recipe exposure, ensuring that this key aspect isn’t affected. Candidate selection, therefore, does not constitute part of the solution and we are only interested in a fixed candidate (recipe) set over a given time frame.</p><p>Our current approach is to assign an equal weight to each of the ‘Cookability’ interactions. We chose this approach, in the first instance, for the purposes of simplicity. We may wish to change this at a later stage however, to incorporate different weights that are based around a particular business objective. In this way, further experiment iteration will allow us to learn how modifications to the various weights can impact key metrics.</p><p>Another important operational project decision was to start with a straightforward approach that has a high likelihood to yield positive results, in order to mitigate risks and avoid lengthy development cycles. We exploited the use of a listwise loss to optimise our model. Each training sample is constructed with one positive from the aforementioned ‘Cookability’ interactions, coupled with sampled negatives; the latter defined as recipes a user has not interacted with. Building on the principle of <em>top one</em> probability to mitigate the n! permutations of possible ranked lists (see <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2007-40.pdf">here</a> for more details) — our loss function can therefore be defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*GWOBoQIPnMOi0Lvr" /></figure><p>This allows us to represent the distance between any two ordered lists of scores y(i) and z(i) respectively. The model we used is a simple <em>three-layer</em> Feed Forward network. This is trained to minimize the above defined loss. It takes as input both computed user and recipe features, with the latter composed of a combination of both text and image representations tuned on our recipe corpus data. The predicted output scores from the model can then subsequently be used to rank and recommend the appropriate candidate recipes for each user.</p><p>When considering the deployment of our personalisation engine, we also chose a similar philosophy to <em>walk before you can run</em>, eventually working our way up to a more advanced service design. A brief overview of the high-level architecture for our deployed system is shown in Figure 2. This demonstrates the evolution of the service architecture. Our current iteration is phase 2, where the streaming ingestion service now consumes recipe edit and publish events from Kafka, generates recipe features, and stores them in our feature store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jGtwuOswHbOCd2Pk" /><figcaption>Figure 2: Evolution of Service Architecture.</figcaption></figure><p>The feature store is built on DynamoDB and houses all of our pre-computed recipe and user features. Recipe features, including both text and image representations, are processed in real-time and ingested via a streaming ingestion service that allows us to score and process the latest recipes published by users on our platform.</p><p>The recipe embeddings relating to those recipes that the user has interacted with, are averaged to generate the user features and this is updated on a daily basis and executed as a batch job. An outcome of this design choice is that our user representations are currently one day behind the latest user data. Simply increasing the frequency of how often the user embeddings creator job runs, would reduce this discrepancy and will be considered for our phase 3 design, but was not deemed to be a necessity at this stage.</p><h3>Results</h3><p>As with any personalisation project, the success of any developed system is assessed by determining its impact on key user and business measured metrics. Using the above detailed system, we extensively make use of A/B testing and run multiple iterations of online experiments across our active regions. The most pertinent metrics are detailed below:</p><ul><li><strong>% Daily FAU</strong> (Feed Active Users) — Number of daily active users engaging on Feed.</li><li><strong>% Retention</strong> — Number of users visiting Inspiration-Feed.</li><li><strong>Number. of Bookmarks</strong> — Average number of bookmarks per user.</li><li><strong>Recipe Visits</strong> — Average number of recipes visited on Feed per user.</li><li><strong>Position</strong> — Average click position on Feed per experiment group.</li><li><strong>View duration</strong> — Average view duration of recipes across users per experiment group.</li></ul><p>Looking into the performance numbers in Figure 3 below, you can see results from one of the latest experiments. The numbers shown represent the computed average of daily figures across the duration of the experiment, which typically operates over a four week period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1CCFgQ4rd1X65D0p" /><figcaption>Figure 3: Experiment Results.</figcaption></figure><p>The five listed experimental features above detail the various approaches included in this particular experiment and are described further below:</p><ul><li>Aux_control: Current recency-based Feed.</li><li>ML_cosine: Baseline personalisation model.</li><li>ML_randomized: Sorting recipes randomly.</li><li>ML_tf_content_clicks: Model optimised on click data.</li><li>ML_tf_content_cookability: Model optimised on ‘Cookability’ signals.</li></ul><p>Comparing the five experimental features side by side in each region allows us to assess the performance of our latest approach. In this particular experiment, we are interested in how the <em>tf_content </em>models perform against our recency-based Feed (<em>aux_control)</em>, the simplest ML baseline model <em>(ml_cosine)</em>, and a random model <em>(ml_randomized)</em>. The latter is key in ensuring any deployed ML model outperforms a randomly sorted Feed.</p><p>As described previously, the <em>tf_content </em>models are optimised to re-rank the order of recipes based on the probability of generating a particular action or signal. The <em>tf_content_clicks</em> model ranks recipes with the highest probability of generating clicks and the <em>tf_content_cookability</em> works to generate the aforementioned ‘Cookability’ actions (<em>bookmarks, cooksnaps, repeat recipe visits </em>and<em> screenshots</em>).</p><p>For each of the five features, users are randomly assigned to each group upon their first visit to the Cookpad app at the start of the experiment. This allocation ensures fair results and comparisons between groups, with each user then remaining in their respectively assigned group for the entire duration of the experiment.</p><p>Looking at the numbers, we can see that for ID Release, the <em>tf_content_cookability </em>model performs best across the key metrics. We can see that compared with the recency-based Feed (<em>aux_control</em>), the ‘Cookability’ personalisation model yields:</p><ul><li>Approx 7% increase in user retention</li><li>10% improvement in average click position (lower means less scrolling)</li><li>12% increase in average recipe view duration</li><li>18% increase in the average number of recipe visits</li><li>And finally a 3% increase in the average number of bookmarks</li></ul><p>For RU region, our <em>tf_content_clicks</em> model performs best with:</p><ul><li>13% increase in retention</li><li>48% increase in the average number of bookmarks</li><li>21% increase in the average number of recipe visits</li><li>Approx 6% improvement in average click position</li><li>Approx 3% increase in average recipe view duration</li></ul><p>Following these positive performance numbers we have established ML Inspiration-Feed as the default experience with 100% rollout across both regions from the above experiment. We anticipate that this exciting development should inevitably lead to similar performance gains across the entire region as well as contribute to higher Premium service conversion rates. We hope to begin tracking this key business metric very soon as we scale our efforts.</p><p>We are now actively planning next steps, with further experimentation and rollouts to new regions coming soon! The ML Team feel that these improvements are just the beginning, as we grow our personalisation project across more regions and also integrate our learnings and developments with Cookpad Search. So, stay tuned for future exciting and impactful ML developments.</p><p><em>I would like to acknowledge the members of the ML team at Cookpad who all contributed to this work: Andrey Ponikar, Jose Navarro, Niall Twomey, Nadine Sarraf, Akbar Gumbira, Prayana Galih and Krystal Zeng. I would also like to acknowledge Alina hryshchuk, Petra Mala and Lutfi hernandi for all their help with web integrations, coordinating and conducting experiments as well as data analysis.</em></p><p>Note: <em>We are also always on the lookout for talented engineers and applied researchers to join the Machine Learning team at Cookpad. Checkout our open roles </em><a href="https://apply.workable.com/cookpad/?lng=en"><em>here</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7eff5921a88" width="1" height="1" alt=""><hr><p><a href="https://sourcediving.com/personalising-cooking-inspiration-with-machine-learning-at-cookpad-f7eff5921a88">Personalising Cooking Inspiration with Machine Learning at Cookpad</a> was originally published in <a href="https://sourcediving.com/">Source Diving</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Recipe Skill Representations Using Skip-Thought Vectors]]></title>
            <link>https://sourcediving.com/building-recipe-skill-representations-using-skip-thought-vectors-8a6e4c38ae6c?source=rss-ec18ad2438c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a6e4c38ae6c</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[seq2seq]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cooking]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Ammar Zaher]]></dc:creator>
            <pubDate>Thu, 15 Mar 2018 15:26:40 GMT</pubDate>
            <atom:updated>2018-03-19T14:31:41.867Z</atom:updated>
            <content:encoded><![CDATA[<p>The question of ‘what to cook?’ can be quite a complex question to answer. It is context-dependent, highly personalised and requires a deep understanding of our users. At Cookpad, it is one of our long standing aims to help people all over the world to answer this question, regardless of their cooking experience. We strive to offer truly personalised suggestions based on their tastes, ingredient preferences as well as current skill level. Striking this fine balance will allow us to provide inspiration to more and more people to cook at home and make the everyday cooking experience fun and well suited for everyone. However, we need to primarily establish how we aim to understand the current skill set of our users.</p><p>To face this challenge, we are using machine learning (ML) to build a system that can understand a user’s current cooking skill set and identify other recipes a user should be able to competently cook. This is one area of focus for our Recipe Embedding project at Cookpad and is where we choose to start tackling the question of ‘what to cook?’</p><p><strong>So where do we start?</strong></p><p>Scalable solutions are imperative at Cookpad, which operates in 60 countries around the globe with 17 different languages and around 90 million users. Thus, our aim is to start with an approach that does not involve overly complex feature engineering or manual efforts that would require us to explicitly create an ontology of cooking skills, for example. We would therefore like to harness the power of state of the art ML methods and techniques and establish their potential to help solve this question.</p><p><strong>Cooking skills data</strong></p><p>A user’s ‘<em>set of skills</em>’ can be viewed as the set of recipe steps from the collection of their authored and cooked recipes list. Each step in the recipe describes a process (or skills) that the user has undertaken (and we assume has acquired) to prepare the dish. Finding a good machine representation of each recipe’s process could therefore potentially allow us to find recipes with similar cooking and preparation processes.</p><p>It is worth noting that the research described in this article represents just one of the approaches we are exploring currently to solve the problem of user skill understanding. It is also worth noting, that understanding how well a user cooks a particular recipe, is not the objective here. Therefore, the outcome is not to be viewed as developing a method to rate a user’s cooking skill, but rather an approach to tailoring recommendations which will in turn allow us to provide a more unique and personalised user experience.</p><p><strong>Encoding a recipe</strong></p><p>The approach we describe here involves a two-stage encoding process that we carry out on each recipe.</p><p>I. <strong>Stage 1</strong>: we find a good representation to encode individual recipe steps that represent a cooking skill(s) to create step embeddings (a fixed length vector).</p><p>II. <strong>Stage 2:</strong> we encode each of the subsequent step embeddings into a more efficient whole recipe embedding, providing a single fixed length vector representation of the ‘skills’ required to cook that particular recipe.</p><p>We will discuss these embeddings and how we build them in greater detail later, but they will ultimately serve as the building blocks which can be used to build many more features. The power of informative machine encodings will have a direct correlation with the strength of our personalisation system.</p><p><strong>Cookpad recipe format</strong></p><p>User published recipes contain text that generally conforms to a simple and typical format; a title, a list of ingredients and a set of recipe steps. We chose to develop separate encodings for each of these components as this allows for more control later on. The reasons for doing so are not pertinent to the problem discussed here but will become clearer later. The focus will be on the embeddings we build for the recipe steps. Below is an example of one of our published recipes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Air_1SaeS1Oi6iMOZnNHZQ.png" /></figure><p>Before moving on any further we should delineate between the terms <em>steps</em> and <em>skills</em> that will be referred to throughout the rest of this article. Using this recipe as an example, the user has split the process into four steps. However, within each of those steps in some cases there are more than one sentence. When we refer to a step within the context of our system we refer to a single sentence. Therefore, this recipe would be classed as having seven steps in total. The reason we split based on sentences is so that we can better compartmentalise and isolate each skill encompassed within the recipe. This isn’t always the case across all of our recipes, of course, as some users do encapsulate more than one process or ‘skill’ in a single sentence when writing their recipes. On the whole, this tends not to be the prevalent case. We choose to stick with this single sentence approach to avoid extra language specific efforts for the time being when tokenising and preparing our data.</p><p><strong>Sentence level embeddings</strong></p><p>This problem of finding machine understandable representations of our sentences falls squarely into the category of natural language processing (NLP). The notion of converting natural text into a problem of vector space mathematics was introduced by <a href="https://arxiv.org/abs/1301.3781">Mikolov <em>et al</em>. (2013)</a>, with the concept of word2vec. For more of the nitty gritty details, see the paper link. This seminal work allowed words to be characterised as word vectors; a sequence of numbers that represent a word’s meaning with regards to how it relates to other words. The vectors can also be referred to as embeddings (as they have information embedded within them). Developing solutions that tackled distributed compositional semantics for sequences of words (sentences) prior to this discovery, was seen as a long standing unsolved problem in the field of language understanding and ML. Since the introduction of word2vec however, there have been several approaches developed for learning composition operators that map sequences of word vectors to sentence vectors using methods such as <a href="https://www.mitpressjournals.org/doi/abs/10.1162/neco.1997.9.8.1735">recurrent networks</a>, <a href="https://arxiv.org/abs/1404.2188">convolutional networks</a> as well as <a href="https://arxiv.org/abs/1409.1259">recursive convolutional networks</a>.</p><p>All of these solutions produce sentence representations that are passed to a supervised learning task. This approach actually tends to work very well and forms the basis of some of our other project initiatives at Cookpad. However, the resulting sentence representations from these approaches are tuned only for their respective task and aren’t too much use outside of this. This is where Skip-Thoughts, our instrument of choice, differs in its design.</p><p><strong>Recipe step Skip-Thoughts sentence level representations</strong></p><p>The Skip-Thoughts model utilises an unsupervised learning approach that makes use of an encoder-decoder model architecture for distributed sentence encoding <a href="https://arxiv.org/abs/1506.06726">(Kiros <em>et al</em>. 2015)</a>. It is inspired by the skip-gram structure used in word2vec but the authors propose an objective function that abstracts this idea to the sentence level instead of individual words. So instead of using a word to predict its surrounding context, a sentence is encoded to predict the sentences around it.</p><p>The assumption that surrounding sentences are closely related seems to hold as well as it does for words <a href="https://arxiv.org/abs/1506.06726">(Kiros <em>et al</em>. 2015)</a>. All that is required is a set of contiguous text to construct a training corpus. This is handy since this is how articles, books and the large majority of writing is generally composed. It can be argued that the sentence contiguity within recipes is not always consistent throughout. However, it is worth exploring as the steps do still refer to the same recipe being cooked and therefore in some way must be related.</p><p>So, let’s delve a little into the encoder-decoder model architecture used to understand how this all works. Encoder-decoder models work on the principle that the encoder encodes source inputs into a fixed length vector representation and the decoder uses this representation to generate the target output. This model architecture can be extremely powerful, and they have gained a lot of traction in a number of different applications such as neural machine translation and image caption generation. So, for example in the context of translation systems, the encoder would be used to encode a source input sentence in one particular language to a vector, and the decoder would condition itself on this representation to generate the target translation to another language. For caption generation the input source happens to be an image and the target is a caption describing the image. The training process forces the model to learn important features from the image to allow it to generate captions when it is fed subsequent images.</p><p><strong>Stage 1 — Step level model training</strong></p><p>Within our context here, we are using the encoder to learn the best representation of the input sentence that would allow the model to produce its best attempt at generating the surrounding sentences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auwRVDiQ3NDji0driRY6qw.png" /><figcaption><strong>Skip-Thoughts Model Architecture</strong>: Sentence s(i) is encoded by the encoder and the two decoders condition on the hidden representation of the encoders output h(i) to try generating s(i-1) and s(i+1)</figcaption></figure><p>The encoder utilises a word embedding layer that serves as a look up table. This converts each word in the input sentence to its corresponding word embedding, effectively converting the input sentence into a sequence of word embeddings. This embedding layer is also shared with both of the decoders. The model is then trained to minimise the reconstruction error of the previous and next sentences using the resulting embedding h(i) generated from sentence s(i) after it is passed through the encoder. Back propagating the reconstruction error from the decoder allows the encoder to learn the best representation of the input sentence while capturing the relation between itself and the surrounding sentences.</p><p>Skip-Thoughts is designed to be a sentence encoder and the result is that the decoders are actually discarded after the training process. The encoder along with the word embedding layer is used as a feature extractor able to encode new sentences that are fed through it. Using cosine similarity on the resulting encoded sentence embeddings, provides a powerful semantic similarity mechanism, where you can measure how closely two sentences relate in terms of meaning as well as syntax.</p><p>We trained our model on our own recipe steps corpus that we created. The results show that after training on a corpus of approximately 1.5 million cooking steps ordered sequentially as recipes from start to finish, the framework does indeed seem to capture semantic and syntax relatedness of recipe steps quite well. Here are four example steps and the corresponding top ten list of most similar steps found across a large sample of our encoded steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxWC-zF5_40G0qW8MNCJ-A.png" /><figcaption>Each example shows a query sentence and its top ten <a href="https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm">nearest neighbours</a> scored by cosine similarity from a random sample of 500,000 steps from our corpus.</figcaption></figure><p>As mentioned at the beginning of this article, a desired outcome of the system we are aiming to build is to provide suggestions of suitable recipes that a user <em>can</em> cook, based on what they have cooked before. As a user’s skills continue to evolve, we would also like the system to take this into account and continue to recommend skill-appropriate recipes. The results shown above work well in the context of finding text with similar meaning, however one could argue that from a cooking perspective the act of cutting a bagel and filleting a chicken are distinctly different. Technically this could be considered a short fall of this approach since this system sees them as being very similar. Definitely an area to explore for the future, but lets ignore this for the time being and move on.</p><p><strong>Stage 2 — Recipe level model training</strong></p><p>The reason why we choose to go beyond the step level embeddings of the encoding process is mainly for exploration to determine what works best in practice but also, for computational efficiency. It is useful to have a single fixed length embedding that represents all of the steps within a particular recipe. This allows us to very quickly be able to return a list of recipe suggestions, based on a user’s previously cooked recipes. It would also allow us to cluster all of the published recipes within Cookpad in an unsupervised manner based on their similarity in skill.</p><p>For stage 2 recipe level encoding we make use of an auto-encoder variation of the encoder-decoder model architecture. The main difference compared to the previous model setup is that the decoder in this instance reconstructs the exact input supplied to its encoder rather than attempting to map it to something else. The model attempts to combine all of the separate step level embeddings from the recipe into a single unique fixed length representation that encompasses all of this information in one tidy and easy to use ‘super-embedding’.</p><p>This time the encoder-decoder model architecture required is much simpler and only requires one decoder as shown in the diagram below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qW06o1KLmbW4bxoXEq124A.png" /><figcaption><strong>Recipe step encoder-decoder Model Architecture</strong>: x(i)-x(N) step embeddings are passed through the encoder and the decoder conditions on the hidden representation of the encoders output h(i) to try generating the exact same step embeddings x(i)-x(N) again</figcaption></figure><p>Again, our aim is to use this model as an encoder and so the decoder is discarded once the model is trained. We run all of our recipes this time with the encoded step embeddings as inputs and store the resulting h(i) representations for each recipe. This time, the query is a recipe embedding and the list of <a href="https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm">nearest neighbours</a> should be a list of recipes that are closely linked in terms of process and skills. So, let’s take a look at some example results.</p><p><strong>Results</strong></p><p>Each example shows a query recipe (with ingredients removed for easier viewing) and the two most similar recipes in terms of recipe steps the system has found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYa9iwef2MS6y20HY9BmOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zCs1QDUi8VVw_WKm01LoAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aR04IHifbiXmsjWX0h4Dhw.png" /></figure><p>The results show that the recipe embeddings definitely do seem to capture recipes of a relatively similar nature. Example 1 for instance captures drink-based recipes, whereas example 2 clearly provides suggestions for baking recipes with similar steps. Example 3, on the other hand, shows recipes with similar processes, however it could be argued that the difference in ingredients between the dishes could cause some issues to users who aren’t familiar with them. This is where our choice of building separate embeddings for each part of a recipe’s components (title, steps, ingredients) will prove to be useful. We could force our suggestion system to bias more towards recipes that have similar ingredients for example, if this is important to a particular user.</p><p>Interestingly, in all these example queries (that were selected at random), you could argue that they could work as recipe suggestions, since they are both similar enough in process yet different enough to still be stimulating for the user. The extent to whether a user that cooked the query recipe in each of these examples could <em>definitely</em> cook the suggested recipes is too subjective for us to comment on in depth any further. I will leave the judgement up to yourselves however and of course our users, through the appropriate verification and user testing channels. One point that could perhaps allow us to improve our suggestions further is if we had a better method of isolating ‘skills’. Rather than using sentences as a method to isolate skills as we have here, we could use this ‘skills tokeniser’ to extract skills directly from our recipe step data and build our embedding representations on this instead.</p><p>As an immediate follow on from this, we could also train a simple preference classifier model on top of the recipe embeddings on a ‘per user basis’ in order to further improve the personalisation. We would use the feedback from the user when a suggestion is made and train a classifier to subsequently classify recipes into ‘like’ or ‘dislike’ categories based on this feedback. This would allow us to further refine the personalisation to a user’s specific tastes.</p><p>In the meantime, however, our explorative research into solving the problem of ‘what to cook?’ continues. More will be revealed in the near future so stay tuned for more exciting developments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a6e4c38ae6c" width="1" height="1" alt=""><hr><p><a href="https://sourcediving.com/building-recipe-skill-representations-using-skip-thought-vectors-8a6e4c38ae6c">Building Recipe Skill Representations Using Skip-Thought Vectors</a> was originally published in <a href="https://sourcediving.com/">Source Diving</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>