Posts tonen met het label food pairing. Alle posts tonen
Posts tonen met het label food pairing. Alle posts tonen

maandag 28 juli 2014

Comparing Asian Cuisines using food pairs

One of the great things of Rachel Laudan's Cuisine and Empire (the New York Review of Book has a very good synopsis/review) is that she offers hypothesis on the history of food that can be tested. Most writers look at cuisines as black boxes, almost magical entities that come and go without underlying logic. Laudan positions them on a continuum of a few dietary philosophies. Why eat what or not? what makes health? what makes good food? There are local influences at work of course but much she explains by what degree competing philosophies left their mark. Two of my favourite episodes from the book are those in which Laudan describes how the various culinary philosophies (Confucian-Taoist in China, Buddhist in India, Islamic coming in from the Middle East, with earlier sacrificial systems remaining present at the background) met and mingled on the Asian continent. Would it be possible to look at major Asian cuisines as they are today (Chinese, Vietnamese, Thai, Korean, Japanese, Indian) and compare and cluster them for their similarity? And would that confirm the clusters of shared influence Laudan's theory predict? If have not a clue.

The above graph takes as input four Chinese and four Indian cookbooks and compares each of them with all others. The result is  a cluster of Indian cookbooks matched with each other (to the right, high similarity), four Chinese cookbooks clustered in the middle and the Chinese/Indian books have least similarity. Having established that cookbooks of the same type of cuisines will be more like each other than others (read: having established that comparing foodpairs is perhaps a way to compare cuisines), we have turned them into one big file representing a cuisine. There are six cuisines present here, derived from 24 cookbooks.

These 'cuisine' files were all compared with each other and this resulted in the following:

 
The horizontal line gives similarity (a 27% similarity between Vietnamese and Chinese food pairs) and the horizontal lines gives the total number of unique foodpairs present (7005 for Vietnamese/Japanese). All cuisines compare least with Indian cooking and that is how theory would predict it (India undergoing most influence from the Middle East) and Chinese and Vietnamese are most alike as I would have predicted it, without any theory to back that up. All the others are roughly equal.

It remains a big question if cookbooks can stand for anything but clumsy representations of the real thing for English-speaking markets. But what are you to do.

zondag 20 juli 2014

Food Pairs 101

What follows is a brief explanation of what our work with foodpairs is trying to do.  

Foodpairing is the theory that foodstuffs go well together if they share key chemical compounds. The ur example is Heston Blumenthal's combination of caviar and white chocolade that both contain high levels of amines. Some work has been done to turn bodies of recipes into frequency lists of foodpairs, creating an informal hierarchy of good taste. 

Here we don't buy into the theory of foodpairing, which is culturally specific anyway, but we are using its concept of a 'food pair'. Our interest is not culinary but historic: can the way cooks and cuisines combine ingredients, now and in the past, show affinities and differences. Can it illustrate larger historic explanations of how cuisines have developed.

The foodpairs for a Aloo Gobi recipe look like this:
cauliflower,chili,1
cauliflower,cumin,1
cauliflower,curcuma,1
cauliflower,garammasala,1
cauliflower,ghee,1
cauliflower,pork,1
cauliflower,salt,1
cauliflower,tomato,1
chili,cumin,1
chili,curcuma,1
chili,garammasala,1
chili,ghee,1
chili,pork,1
chili,salt,1
chili,tomato,1
cumin,curcuma,1
cumin,garammasala,1
cumin,ghee,1
cumin,pork,1
cumin,salt,1
cumin,tomato,1
curcuma,garammasala,1
curcuma,ghee,1
curcuma,pork,1
curcuma,salt,1
curcuma,tomato,1
garammasala,ghee,1
garammasala,pork,1
garammasala,salt,1
garammasala,tomato,1
ghee,pork,1
ghee,salt,1
ghee,tomato,1
pork,salt,1
pork,tomato,1
salt,tomato,1
A diagram of it looks like this, a network with all nodes connecting each other.


Here is a graph of the same aloo gobi but combined with those for a Lasagna recipe. They share an ingredient but have no foodpair in common.


When graphing foodpairs for a larger body of recipes, a cookbook, some combinations will be more common than others, this is expressed with line-width and distance as this graph of a Madhur Jaffrey cookbook shows:


It seems reasonable to suggest that different cuisines will each have a preference for certain ingredients and when they use the same ones they will combine it differently. It also seems reasonable to expect that cuisines that developed together will differ less than cuisines that didn't. This is what we want to verify.

By combining the foodpairs of the Jaffrey book with a Mexican cookbook we get the graph below. It gives some information about their commonality but without context nothing definite can be said.
To make some real sense of the ways foodpairs show affinity across the culinary scale we need a metric. The Jaccard index is a simple way to calculate similarity in data-sets. When comparing two sets that are exactly alike (comparing the foodpairs of a book with the foodpairs of its unchanged reprint) it will score 1 -> 100% similarity. If they are completely different the score is 0. 

Using the same Mexican and Indian cookbook as above we can calculate the Jaccard index as 0.11- > of the 8135 unique foodpairs the books together yield, 11% are present in both books. Without context it is a useless number but now look at the graph below that compares the foodpairs from the Jaffrey cookbook with 13 other cookbooks covering a number of styles (national cuisine and celebrity chefs). 

The Jaccard index (in whole percentages) is mapped horizontally. The vertical scale gives the total number of unique foodpairs in both books. 

That Jaffrey compares most with another Indian cookbook gives us some comfort that we are not generating random data. Jaffrey comparing least with Rene Redzepi's NOMA cookbook feels right too. The theory that Mexican and Indian food share the same middle eastern influence is hard to corroborate with this, but it could be informing that it finds more commonality with Middle Eastern food (and Greek) than with anything else.



The next graph compares the Mexican cookbook with the same books. The highest similarities found are with a book by Nigella Lawson and with a book on Hawaiian food. Notice the position of the two Chinese cookbooks in the left corner for both graphs.



Note: saying that we are comparing cuisines is obviously not true. We are comparing English language cookbooks written for an audience of English speaking home cooks, explaining them the things they expect to be explained and with ingredients that can locally purchase. Which brings us to the unanswered question what a cookbook really represents. 
In any case: the problem of meaning here is endless and this stuff will explain nothing.

zondag 13 juli 2014

IBM's FlavorBot


Twitter amigo Theun shared this article on Chef Watson IBM program for an AI constructing recipes.
The invite-only portal lets users enter ingredients, the type of food they want to prepare (a sandwich? a stir-fry?), and a “style” to prepare food in such as Indian or Austrian, and then automatically generates 100 recipes based on those parameters. One of the big advantages for Watson’s data scientists is that Bon Appetit presented them with a recipe database that was preformatted and quality tested, making IBM’s job easier.
 Of course they want it easy!

Another article gives us the above image of a recipe for a computer generated Indian Turmeric Paella. 

<Insert cynic quip>

Both articles suggest that big data firms are ready to quantify taste and flavor on a scale of "hedonic psychophysics" or "the psychology of what people find pleasant and unpleasant" in order to manipulate and sell it. 
To generate these food leads, if you will, AI cross references three databases of information:
  1. A recipe index containing tens of thousands of existing dishes that allows the system to infer basics like “what makes a quiche a quiche”
  2. Hedonic psychophysics, which is essentially a quantification of whether people like certain flavor compounds at the molecular level
  3. Chemoinformatics, which sort of marries these two other databases, as it connects molecular flavor compounds to actual foods they’re in
<Insert another cynic quip>

I might be sitting on a gold mine!

Another article gives 4+1 recipes generated by chef Watson. The compare-yr-recipe of these is like below. A nice, well demarcated, image showing each recipe as having its own well-defined ingredient-spectrum. So who is choosing what recipe to cook of the hundreds generated? As Gary Kasparov said about Deep Blue when he lost: It was the hand of God.


What IBM is shirking from using is the term food pairing, in the IBM Watson Cognitive Cooking Fact Sheet they prefer the idiotic term Cognitive Cooking. 
At the heart of this cognitive cooking system are a set of algorithms that draw upon a number of datasets, regional and cultural knowledge as well as statistical, molecular and foodpairing theories to come up with dishes that are high in surprise, pleasantness and pair well. The system begins by capturing and analyzing tens of thousands of existing recipes to understand ingredient pairings and dish composition, and which it rearranges and redesigns into new recipes. It then cross references these with dataon the flavor compounds found in ingredients, and the psychology of people’s likes and dislikes (hedonic perception theory) to model how the human palate might respond to different combinations of flavors.
This line from the same factsheet is of course complete bullshit:
IBM’s cognitive cooking system can reason about flavor the same way a human uses his palate.

zaterdag 10 mei 2014

Food pairing / gastronomy with a telescope

The theory of food pairing inspires little faith (see earlier) but when moving away from culinary applications perhaps it can be used to differentiate cuisines and cooking styles. How Chinese is Jamie Oliver? How similar are Mexican and Indian cuisines? How do French and Indian cooking differ? How unique is Rene Redzepi? 

The aim is to find a way to reveal the inner structure and logic of a cuisine, if such a thing exists, by comparing the way a cuisine or a cook combines ingredients with other cuisines and cooks. The first step is turn a collection recipes (a cookbook) into ingredient pairs, here is what a fragment of a looks like:
potato,pork,2
chicken,cucumber,1
chicken,grapeseed,15
chicken,milk,6
chicken,onion,9
chicken,pork,3
cucumber,grapeseed,3
cucumber,onion,2
cucumber,pork,2
grapeseed,milk,10
grapeseed,onion,11
grapeseed,pork,4
milk,onion,2
milk,pork,1
Two recipes use both potato and pork, one recipe combine chicken and cucumber, 15 recipes combine chicken with grapeseed oil and so on down the list. In a graph the pairs look like this:

The problem is in the data more than in the code. To get to lists of ingredients as recipes that are easy to process I am using Eat Your Books, a website that catalogs recipes and cookbooks. The ingredient lists are not complete (what exactly are 'cupboard ingredients'? a reference to the mock turtles of the soup) but they will do for my purpose.

Here is the graph of 'An Invitation to Indian Cooking' by Madhur Jaffrey (1975). It is pretty much what you would expect, a chaotic self-referential hairball with the core ingredients in the center with the rarer or less staple ingredients pushed to the edge. All graphs can be enlarged, the real information however is in the shape of the graph, not in the name of ingredients.


A different projection shows the connections differently, clearer on the eyes but not necessarily better: 
If you were creating something that would generate options for chefs you could take a book like "French Home Cooking: An Introduction to Classic French Cooking" by Paul Bocuse (1989) to generate diagrams like the following that shows what Indian (blue) and French (red) cuisines combine with potato and carrots.
It is of course bad practise to use one cookbook as representing an entire cuisine, but we are here in illustrative mode. Indian and French cuisine are national cuisines; how do they compare with someone like Rene Redzepi. With what ingredients does he (in green) combine the humble potato and carrot in his book "Noma: Time and  Place in Nordic Cuisine" (2010)? I a French manner.


But from the perspective of dry cooking this is still puny and close to home. The next image compares French and Chinese cuisines. The French is the Bucase book (blue), the Chinese (red) is Ken Hom's "A Taste of China" (1990). Again we are not actually comparing cuisines but cookbooks representing a certain regional form of cooking to a Western audience but the differences are real. Chinese and French cooking are worlds apart and only share some basics like vinegar, onion and pork. Chinese cooking comes across as much more homogenous and compact.

Now add Jamie Oliver's "The Naked Chef" (2000) to this French/Chinese data and see what happens: Jamie Oliver's cuisine is like a giant flesh eating amoeba devouring both cuisines whole and it still remains hungry. For now it is seems more French then Chinese.
Here is what happens when comparing Rene Redzepi (red) and Jamie Oliver. Even though the two appear to be opposites (the wild vs the supermarket, the avant-garde vs the popular) this graph does not really show it as you can see by the overlap. Both are Western chefs cooking Western food even when many ingredients are not shared.

The next image returns to the observation that Indian and Mexican food are historic twins. Would food pairing confirm this? Comparing Jaffrey (blue) with "Rosa's New Mexican Table" by Roberto SantibaƱez (2010) resulted in the following. The two cuisines are structured as separate spheres with a few heavily contested ingredients. Ingredients do not a cuisine make, as Rachel Laudan would possibly say as this graph seems to say.
 

In conclusion, to show that two similar bodies of recipes will overlap, I have compared Jaffrey with "50 Great Curries of India: Tenth Anniversary Edition" by Camellia Panjabi (2006). Both writers are of course using different ingredients but this image, in combination with the images above, do suggest a metric of displacement and uniformity: similar recipes will generate similar and overlapping hairballs.