data science and food pairing - 2 articles
Empirical ZealA New Kind of Food Science: How IBM Is Using Big Data to Invent Creative Recipes
Computers are constantly getting smarter. But can they ever be creative? A team of IBM researchers believes so. They’ve built a program that uses math, chemistry, and vast quantities of data to churn out new and unusual recipes.
To build their algorithm, the researchers modeled the steps that we might go through to develop creative ideas. First, you need to understand the problem that you’re trying to solve. Then, build expertise by learning everything you can about the problem. With this knowledge under your belt, generate a bunch of new ideas, and maybe even combine different types of ideas. Then pick the most creative ideas from the lot. Finally, implement your idea. While computers have executed many of these steps before, the key insight of the IBM group was to find a way to quantitatively gauge the creativity of a recipe, and to put all the different pieces together.
“I have dishes from the system all the time”, says Lav Varshney, who led IBM’s team to develop this novel recipe generation engine. “Some of the recipes that we created ourselves like the Kenyan Brussels sprout gratin, the Caymanian plantain dessert, and the Swiss-Thai asparagus quiche are very good. Others that we did jointly with our partners, the Institute of Culinary Education, like the Spanish almond crescent and the Ecuadorian strawberry dessert are world-class.”
So let’s see how IBM’s computational chef gets creative.
Step 1: Define the problemWhen you start the program, you’re asked to pick a key ingredient, choose some regional cuisines you’d like to explore, and decide what type of dish you’re interested in (a soup, a quiche, etc.).
Step 2: Learn everything you can about the problemThis is where all that data comes in. The researchers used natural language processing algorithms to scan and parse the text of millions of different recipes. Using this data, they convert a written recipe into a web of relationships, including the quantities of different ingredients and the processes that transform these ingredients into food. They also scanned Wikipedia to learn which ingredients are commonly used in various regional cuisines. They went through handbooks of flavor ingredients to learn which molecules are present in different food ingredients, and also included information about the chemical structures of these molecules. They also included data on how humans rate the ‘pleasantness’ of 70 different chemical compounds.
In the end, the researchers had amassed a vast computer-readable body of knowledge about human flavor preferences, regional recipes, and about the chemistry behind these recipes.
Now the program is ready to start cooking.
Step 3: Generate ideas to solve the problemStarting with the traditional recipes of a certain cuisine, the software generates millions of new recipe ideas that match the user’s preferences. They don’t just throw out these recipes at random. The recipes that are generated respect an empirical rule-of-thumb called the food pairing principle. This says that ingredients that pair well together in a recipe share common flavor molecules. (You can read more about food pairing in this great summary by Wired’s Sam Arbesman.)
The new recipes are generated by ‘mutating’ the ingredients of existing recipes, and then fusing these with other recipes, resulting in all sorts of new hybrid concoctions. (This idea, known as a genetic algorithm, is modeled after the process of genetic change.)
As the comic suggests, it’s somewhat unfeasible to find friends willing to try out a million bizarre new recipe ideas (deep-fried skittles, anyone?) So, instead, the program automates the process. This is the really clever bit.
Step 4: Select the best ideasAccording to Varshney, “Many previous attempts at computational creativity have been good at the generative part of creativity but not at the selective part of creativity. I think our major contribution has been to show how [..] big data models can be useful not just for creating a billion ideas but for pointing out, say, the ten best ideas.”
So how does a computer decide which ideas are the most creative? The first thing you need is an operational definition of creativity. Ken Robinson defines creativity as “the process of having original ideas that have value.” The IBM researchers adopt a similar metric. According to them, a creative idea should be novel, and should be high-quality.
Let’s take on novelty first. You’d probably agree that peanut butter and jelly can go together. And you probably also think it’s ok to put mustard on a hotdog. That’s because you have a set of beliefs about the likelihood of various recipes. These beliefs are based on what you think tastes good, but they’re also strongly influenced by the foods that you’ve been exposed to.
But you might never have thought to put peanut butter on a hot dog. This recipe clashes with your beliefs about food, and this is what makes it surprising. In contrast, a hotdog with mustard has absolutely no effect on your beliefs about recipes. It’s a totally boring recipe.
This IBM scientists used a very similar idea – they measured the novelty of a recipe by quantifying how much it alters one’s existing recipe worldview. They accomplished this with a mathematical tool known as Bayesian surprisal. (This tool has previously been used to identify what parts of a video people tend to pay most attention to.) Here’s how Varshney explained the concept to me. “Bayesian surprise basically compares prior beliefs about food with new beliefs after the introduction of the newly created recipe; the greater the change in beliefs, the greater the surprise.”
Now, consider quality. Taste is a complex thing. Our tongue teases apart the basic tastes: sweet, salty, sour, bitter, and umami. But there’s so much more to our experience of food: whether the food is warm, creamy, gooey, chunky, slimy, the way it sits on your tongue, the way it crunches when you bite into it, how hungry you are, the memories that you associate a taste with, and so on.
The researchers argue that in spite of all this, they key to taste is really smell. “Work in neurogastronomy argues quite strongly that [smell] is the central contributor [to flavor perception]”, says Varshney. If that sounds counter-intuitive, think about how bland your food tastes when you have a bad cold — your taste receptors are working fine, but you can’t smell a thing.
But how does the program know how a dish smells? It all comes down to chemistry. The software goes through all the different flavor molecules in a recipe and looks up their chemical properties – these include technical terms like “topological polar surface area, heavy atom count, complexity, rotatable bond count, and hydrogen bond acceptor count.” By comparing these chemical properties to that of 70 other odor molecules, the researchers can predict how ‘pleasant’ a particular molecule will smell. They then mix the scents of different molecules together on the computer, and arrive at an overall ‘pleasantness’ of smell of each dish. Think about how surprising this is for a moment — they’re predicting how pleasant a dish will smell using the chemistry of the flavor molecules inside the it!
I asked Varshney about this startling finding, and he responded, “I also find it surprising that it is possible to predict a hedonic percept like pleasantness from molecular properties like the number of heavy atoms, but there is much emerging work in hedonic psychophysics that shows exactly this. Going forward, we hope to incorporate finer aspects of human flavor perception into our models.”
Step 5: Implement your ideaFinally, the software generates a list of recipes ranked using three categories: surprise, pleasantness of odor, and flavor pairings.
Now it’s finally time to leave your laptop and head to the kitchen.
As for Lav Varshney, he isn’t done exploring what the system has to offer. He says, “I was in Berlin this past weekend and we partnered with a chef there to do a full banquet which turned out really well. I particularly liked a grilled tomato on a saffron crouton, and a quark crème caramel with cranberry and caraway ice cream.”
In the near future, you might even see computer generated food in a store near you. Varshney adds, “We have been having discussions now with several large food manufacturing companies, food services companies, and flavor/fragrance houses about this technology.”
Data Mining Indian Recipes Reveals New Food Pairing PhenomenonBy studying the network of links between Indian recipes, computer scientists have discovered that the presence of certain spices makes a meal much less likely to contain ingredients with flavors in common.
The food pairing hypothesis is the idea that ingredients that share the same flavors ought to combine well in recipes. For example, the English chef Heston Blumenthal discovered that white chocolate and caviar share many flavors and turn out to be a good combination. Other unusual combinations that seem to confirm the hypothesis include strawberries and peas, asparagus and butter, and chocolate and blue cheese.
But in recent years researchers have begun to question how well this hypothesis holds in different cuisines. For example, food pairing seems to be common in North American and Western European cuisines but absent in cuisines from southern Europe and East Asia.
Today, Anupam Jain and pals at the Indian Institute of Technology Jodhpur say the opposite effect occurs in Indian cuisine. In this part of the world, foods with common flavors are less likely to appear together in the same recipe. And the presence of certain spices make the negative food pairing effect even stronger.
Jain and co began their work by downloading more than 2,500 recipes from an online cooking database called TarlaDalal.com. These recipes come from eight sub-cuisines, including Bengali, Gujarati, Punjabi, and South Indian, which together span vast geographies, climates, and cultures in the Indian subcontinent.
Together, these recipes contain 194 different ingredients. The average recipe contains seven ingredients but some can contain up to 40. In particular, the Mughlai sub-cuisine has many recipes with exceptionally large numbers of ingredients, probably because of its royal heritage.
Jain and co then created a flavor network in which ingredients are linked if they appear together in the same recipe. The network can then be studied for interesting phenomenon such as clustering effects.
The question that the team set out to answer was to what extent food pairing is positive or negative. In other words, do ingredients sharing flavor compounds occur in the same recipe more often than if the ingredients were chosen at random.
The results make for interesting reading. Jain and co conclude that Indian cuisine is characterized by strong negative food pairing. Not only that, but the strength of this negative correlation is much higher than anything previously reported.
They also found that specific ingredients dramatically effect food pairing. For example, the presence of cayenne pepper strongly biases the flavor sharing pattern of Indian cuisine towards negative pairing. Other ingredients that have a similar effect include green bell pepper, coriander, garam masala, tamarind, ginger, cinnamon and so on.
In other words, spices make the negative food pairing effect more powerful, a phenomenon never seen before. “Our study reveals that spices occupy a unique position in the ingredient composition of Indian cuisine and play a major role in defining its characteristic profile,” say Jain and co.
That result has some interesting corollaries. In many cuisines, spices add flavor but also prevent food spoilage by killing certain types of bacteria. Jain and co say this medicinal role must have had a significant effect on the way recipes evolved since removing these ingredients would have had health impacts. “We conclude that the evolution of cooking driven by medicinal beliefs would have left its signature on traditional Indian recipes,” they say.
The result also has implications for the future of food. In the same way that Western chefs search for unusual ingredients that share the same flavors, negative food pairing may also drive the development of new flavor combinations and recipes in Indian food. “Our study could potentially lead to methods for creating novel Indian signature recipes, healthy recipe alterations and recipe recommender systems,” conclude Jain and co.
Beyond that, this work shows how powerful network science has become in analyzing disparate aspects of everyday life. Treating recipes as networks has turned out to be a powerful tool that is changing the way we think about food and how we consume it.