Deep Learning Algorithm Rewrites Traditional Recipes for New Regions, Ingredients

Algorithmic gastronomy is here.

Michael Byrne

Michael Byrne


Imagine your favorite go-to recipe mutated to conform to the traditional methods and ingredients of any number of diverse regional food cultures. Consider, say, lasagne, but a sort of lasagne that's instead a naturally occurring part of Japanese or Ethiopian cuisine. Not "fusion," but something deeper—a whole rewriting of what a lasagne even is according to the culinary traditions of some other place.

It's not necessarily an easy or natural thing to do, but a new machine learning algorithm developed by a team of French, American, and Japanese researchers offers an automated solution based on neural networks and large amounts of food data. The result, which is described in a paper published this month to the arXiv preprint server (via I Programmer), is a system that can take a given recipe and shift it into an alternative dietary style—sushi lasagne, say—as well as parse a recipe for its underlying style components.

Recipes are a curious space when it comes to data. A recipe, which is itself an algorithm, is an aspect of culture that's very carefully quantified, whether that's in terms of tablespoons, ounces, or in the ratios between ingredients. It seems natural even to want to subject recipes to statistical analysis, particularly as food cultures continue to mix and hybridize.

"With growing globalization and economic development, it is becoming difficult to identify a recipe's dietary style with specific traditional styles since dietary patterns have been changing and converging in many countries throughout Asia, Europe, and elsewhere," the paper explains. "Regarding the latter challenge, to the best of our knowledge, little attention has been paid to developing algorithms which transform a recipe's dietary style into any selected dietary pattern."

The first component of the system is tasked with taking in a large number of recipes and using those to train a neural network as to what recipe features represent the culinary style of a given country. This model can then be used take in new lists of ingredients and make predictions as to what country's' cuisines that list corresponds to. This part is a fairly typical machine learning classification problem.

The next part of the system takes the recipe's style mixture and visualizes it as a Newton diagram (below), which displays mixtures within data as two-dimensional coordinates.

The third part of the system takes ingredients and clusters them via what's known as a word2vec model. Commonly used in textual analysis, this is a way of quantifying associations between words, or, in this case, recipe ingredients. Similar words/ingredients are represented by similar associations of words/ingredients. The result is a rather deep way of saying how similar ingredients are to one another, and, as such, what ingredients can be substituted for other ingredients. This is how the system comes up with its alternative recipe variations.

The results of one such conversion are visualized below. The researchers, which include a professional chef, actually went and cooked the resulting recipe. Looks good enough to me, though I generally have the diet of a racoon.

Eating better is the ultimate point here. "Unhealthy dietary style is one of the most important public health issues to be tackled," the paper notes. "Given that past research has identified what makes a recipe healthy, future efforts should pay attention to the development of data-driven systems which can transform such healthy recipes into any given dietary style. Then a scientifically proven healthy dietary style could be acceptable in accordance with a user's unique food preferences."

So, thanks to neural networks perhaps even my racoon-diet could be algorithmically tweaked to be something like healthy.