Food & AI

Cognitive Cooking and Flavor Network

Xuan Huang

A few years back, IBM’s Chef Watson was making a splash among geeky foodie fans – if that name rings a bell, you guessed it right – it was the same Watson who had won the Jeopardy! game and whose cousin AlphaGo went on to defeat the Go Master.

Chef Watson was a computer program of cognitive cooking, “a computer program that helps cooks discover and create original, totally unique recipes with the help of flavor compound algorithms”. You name a whimsical initial ingredient, dish, and theme, and it would create a recipe that fits your criteria. From “Danish banana empanada” to “Vietnamese apple kebab”, Chef Watson was unapologetically avant-garde. It had analyzed tens of thousands of recipes from Bon Appétit recipe database and was built upon a rich dataset of complementary flavor compounds. It had gained insight into what ingredients work better together and how they map to a certain cuisine.

I was immediately a fan. I bought its cookbook; I followed the news; I zealously pored over its beta-test app; and by the time I had put candied bacon into my homemade ice cream, the fanfare also came to an end: some of the recipes were just too odd for a home cook.  Fast forward a few years later when we started Mealvana, I was trying to find out how Chef Watson was faring and it was nowhere to be found, leaving only traces through dated news mentions. The test site seemed to have been unplugged since 2018. At this point I can only assume it got rich and retired early, or it had got smarter and broke free from the Human race. Or, it had been hijacked by the aliens.

Nevertheless, the idea it planted in me has taken root and started to grow. A recipe is a combination of ingredients. With hundreds of commonly available ingredients, there are easily 1025 possible combinations. Among them, a surprisingly large portion actually works – that explains why so many of us feel like decent home cooks: you simply cannot go very wrong with food! But of course, certain combinations work magic: basil with tomatoes, the mirepoix, bourbon and lemon juice. That would be wonderful, we thought, to create a program that assists creating everyday recipes that has sensible pairing.

There are a few ways to go about from here. Hard coding the culinary knowledge into logic rules would be the most obvious one. Then the next would be deriving pairing information from a large recipe dataset. For example, the probability of cinnamon used in a recipe given that apple is in the recipe P(Cinnamon|Apple) can be calculated using Bayes’ theorem – in case you are curious, using our dataset it is calculated to be 50.1% and it is 9.8% the other way around for P(Apple|Cinnamon). If the dataset is robust enough, this second approach would likely generate empirical pairing suggestions that coincide with the hard coded rules, and may help you discover some overlooked rules. Lastly, researchers have found that western cuisines like to pair together ingredients that share flavor compounds while eastern cuisines tend to do the opposite. So theoretically with the ingredient flavor compound data, a program can be built to recognize, for example, that chocolate and blue cheese actually share flavor compounds and therefore pair well with each other. This approach is likely generating some pairing insight that hasn’t been discovered before but it relies heavily on the hypothesis that sharing compounds suggests good pairing potential.

We went with a combination of the first two approaches and built an algorithm that assist our chef to build robust recipes. To give you a peep under the hood, entertain a basic oatmeal recipe that is a combination of steel-cut oats, milk, salt, and maple syrup. When, for example, the fall season is upon us, our chef decides to include the pumpkin purée and apple. What other flavoring ingredients, our chef asks, should be added to the recipe? Here is the output from our program suggesting the top ten ingredients to be considered:

Spices, cinnamon, ground
Sugars, brown
Butter, without salt
Sugars, granulated
Spices, nutmeg, ground
Ginger root, raw
Spices, cloves, ground
Pork, cured, bacon, unprepared
Nuts, walnuts, English
Raisins, dark, seedless

Quite making sense, right? Among them we picked cinnamon, butter, nutmeg, ginger, walnuts, and raisins.

To visualize how the pairing is working inside a recipe, we plotted a flavor network. Each “node” in the flavor network represents an ingredient in the recipe. The size of the node is proportional to the weight of the ingredient it represents. An “edge” connecting two nodes represents the pairing potential between two ingredients. The thicker the edge, the higher the potential. A more connected network translates into a better balanced recipe, in terms of flavor pairing.

Quite complexed – but that’s a good thing, because that means the ingredients pair well together and are quite connected. To visualize the key pairings, let’s thin out some weaker edges.

How about thinning it further?

One more step further?

Judging from the last graph, if you want a more basic version but don’t want to compromise the texture, you may forego the ginger and butter. Like what you see? Try our recipes. (This particular recipe is waiting to be tested by our chef, who we promise is a human. Try something else first but remember to come back to snatch this recipe later!)

reference