IBM’s Watson supercomputer tackles the problem of creativity in cooking

IBM’s supercomputer research team has been pushing the boundaries of what computers are capable of. Their Deep Blue first beat Kasparov at chess almost 20 years ago. Later, IBM’s Watson beat Ken Jennings at Jeopardy. And now the same Watson is tackling the most difficult problem yet – cooking and creativity.

IBM Research has begun work on an unnamed cyberchef, an AI system designed to create new dishes that can delight our palates at their theoretical peaks of enjoyment.

Why bother teaching a computer how to cook? Of course, the first reason is that it advances computer science. But there is another interesting angle. The supercomputer could cook up recipes that have never been seen by man, because there are some things that computer are just better than humans at:

For example:

In the case of the flavorbot, these “new things” IBM is after range from spotting underrated, highly flavorful ingredients (like black tea, bantu beer and cooked apples), strange-but-tasty flavor pairings (like white chocolate and caviar, jamaican rum and blue cheese, or even bell pepper and black tea), and even whole recipes, complete with basic preparation steps.

And how does Watson do this? Unsurprisingly, this is rather difficult. More interestingly, lots of science and maths comes into play here.

This is a high level description of what the AI needs to do:

To generate these food leads, if you will, AI cross references three databases of information:

  • A recipe index containing tens of thousands of existing dishes that allows the system to infer basics like “what makes a quiche a quiche”
  • Hedonic psychophysics, which is essentially a quantification of whether people like certain flavor compounds at the molecular level
  • Chemoinformatics, which sort of marries these two other databases, as it connects molecular flavor compounds to actual foods they’re in

And here is a journalist’s article about the results; he was sent a bottle of Watson’s Bengali Butternut Barbeque Sauce and this is what he found:

When I unwrapped the brightly colored box and found the bottle inside, I immediately flipped to the back label. Most BBQ sauces start with ingredients like vinegar, tomatoes, or even water, but IBM’s stands out from the get go. Ingredient one: White wine. Ingredient two: Butternut squash.

The list contains more Eastern influences, such as rice vinegar, dates, cilantro, tamarind (a sour fruit you may know best from Pad Thai), cardamom (a floral seed integral to South Asian cuisine) and turmeric (the yellow powder that stained the skull-laden sets of True Detective) alongside American BBQ sauce mainstays molasses, garlic, and mustard.

I pour a bit of the bottle onto a plate of roasted tofu and broccoli–even a pork lover has gotta watch his cholesterol–and tentatively took a bite. Watson’s golden sauce may have the pulpy consistency of baby food, but it packs a surprising amount of unique flavor.

Immediately, you can taste the sweet warmth of the wine and the squash. The tamarind blends seamlessly, backed by a duo of vinegars, to tickle your tongue with just the right amount of tartness. The other flavors combine to leave an indefinable, warm aftertaste that, as you have a few more bites, actually heats your mouth–thanks to Thai chiles

This resulted in a reddit discussion, and one of the people working on this project showed up to share details of how exactly it works:

In a nutshell, however, Watson consumes massive amounts of recipes from different sources and then parses out the ingredients and steps. It also takes in information about the basic flavor compounds in ingredients, the general nature of ingredients, and, perhaps most interesting, a database of the “pleasantness” of flavor compounds, and a few other things that really make up Watson’s “secret sauce”.

From there it’s a collaborative creative process between chef and watson. It typically starts with an ingredient. Let’s say “cardamom”. Watson then searches the database, which is a pretty straight forward process, for the types of cuisine that have that ingredient. For cardamom there are about 100 different cuisines from Indian to Swedish to Bhutani and Barbadian that have a recipe somewhere that uses cardamom. Next it searches through the recipe database to pick out recipes that have cardamom in it. Cardamom is most often found in soups and cake, but it also can be found in things like fudge, baklava, and kebabs.

In the next step Watson starts to create a template of what it thinks might go in Swedish/Barbadian fudge with cardamom. Here’s where you can go crazy with Watson. The most common elements are automatically selected, but there’s lots of other options. For example, most fudge has a sweetener, chocolate, dairy, oil, and some nuts. Because we wanted cardamom, Watson recommends some spices too. You can go crazy and add in things like meat, alcohol, cheese, and a variety of other things at this step. You can’t just add in anything you want because there are some things that Watson has a hunch will just turn out to be nasty.

In the final step Watson generates a number of recipes that meet the guidelines provided. It tries to ensure that the ingredients selected match up with the various cuisines and also with the dish selected. In addition, using some of the “secret sauce” it makes sure that the ingredients will taste good together too. At the end it presents a number of recipes rated on scales such as “surprise”, or how rare is recipe like this compared to the database, “pairing”, or how well do the flavors pair or contrast with each other, and “pleasantness” which is based on the science of hedonic psychophysics. From there the chef works with Watson to find the best recipe.

That final paragraph sounds so cool. You randomly suggest a bunch of ingredients to a supercomputer and it comes up with interesting recipes based around your rough guidelines, while all the time preventing you from totally screwing up and ensuring that the resultant dish will taste good. (But, this is also reminding me of Arthur in the Hitchhiker’s Guide to the Galaxy and his struggles to get Eddie, the shipboard computer, to make him some tea.

References:

Will antibiotics stop working and will medicine be flung back to the 19th century?

Antibiotics have literally changed the world. Before antibiotics were invented, it was pretty routine for people to die of minor infections, like being scratched by a rose bush, or during childbirth. But antibiotics changed the world of medicine in ways that could only be described as miraculous.

Unfortunately, there is a possibility, that at some time in the near future, antibiotics will stop working as more and more antibiotic resistant strains of bacteria are emerging, and faster.

I first came across this article earlier this year, and was sufficiently alarmed, but on second thoughts, I wasn’t sure whether the author was simply overhyping the whole thing. However, a few weeks ago, WHO has come out with a report on this issue, which pretty much sounds a general worldwide alarm:

“Without urgent, coordinated action by many stakeholders, the world is headed for a post-antibiotic era, in which common infections and minor injuries which have been treatable for decades can once again kill,” says Dr Keiji Fukuda, WHO’s Assistant Director-General for Health Security. “Effective antibiotics have been one of the pillars allowing us to live longer, live healthier, and benefit from modern medicine. Unless we take significant actions to improve efforts to prevent infections and also change how we produce, prescribe and use antibiotics, the world will lose more and more of these global public health goods and the implications will be devastating.”

Where are “antibiotic-resistant” bacteria coming from? This works in pretty much the same way as vaccinations work. Basically, when bacteria are exposed to less than a full dose of antibiotics (i.e. when you discontinue antibiotics before the full course is over), they develop an immunity to that antibiotic. Basically, literally, what doesn’t kill them, makes them stronger. Now this strain of bacteria starts spreading… This process repeats with all the different antibiotics we have. And sooner or later we end up with strains of bacteria that are immune to all antibiotics known to man.

And this problem is getting worse. For example:

Tetracycline was introduced in 1950, and tetracycline-resistant Shigella emerged in 1959; erythromycin came on the market in 1953, and erythromycin-resistant strep appeared in 1968. As antibiotics became more affordable and their use increased, bacteria developed defenses more quickly. Methicillin arrived in 1960 and methicillin resistance in 1962; levofloxacin in 1996 and the first resistant cases the same year; linezolid in 2000 and resistance to it in 2001; daptomycin in 2003 and the first signs of resistance in 2004.

Source

What is the meaning of all this? A hundred years ago, people used to die of minor infections. We, who’ve been lucky enough to be born in the age of antibiotics don’t know what that feels like. But maybe we’ll get to experience that soon enough:

The chief medical officer of the United Kinigdom, Dame Sally Davies — who calls antibiotic resistance as serious a threat as terrorism — recently published a book in which she imagines what might come next. She sketches a world where infection is so dangerous that anyone with even minor symptoms would be locked in confinement until they recover or die. It is a dark vision, meant to disturb. But it may actually underplay what the loss of antibiotics would mean.

This is not just a problem for people who get injured. A lot of modern medicine depends upon antibiotics. Most surgery would become potentially lethal if antibiotics don’t work:

Many treatments require suppressing the immune system, to help destroy cancer or to keep a transplanted organ viable. That suppression makes people unusually vulnerable to infection. Antibiotics reduce the threat; without them, chemotherapy or radiation treatment would be as dangerous as the cancers they seek to cure. Dr. Michael Bell, who leads an infection-prevention division at the CDC, told me: “We deal with that risk now by loading people up with broad-spectrum antibiotics, sometimes for weeks at a stretch. But if you can’t do that, the decision to treat somebody takes on a different ethical tone. Similarly with transplantation. And severe burns are hugely susceptible to infection. Burn units would have a very, very difficult task keeping people alive.”

Forget surgery. Something as simple as childbirth will become dangerous once again:

Before antibiotics, five women died out of every 1,000 who gave birth. One out of nine people who got a skin infection died, even from something as simple as a scrape or an insect bite. Three out of ten people who contracted pneumonia died from it. Ear infections caused deafness; sore throats were followed by heart failure. In a post-antibiotic era, would you mess around with power tools? Let your kid climb a tree? Have another child?

Update: I was reminded by Farhat (see his comment below) of a few things that I left out of this post:

  • This is already happening. In the last one year, I know of at least two cases in my friends’ circle, where an elderly person, who was otherwise healthy, and was admitted to a hospital for a non-life-threatening condition, and was cured, but contracted a “hospital infection” just before getting a discharge, and then died less than 2 weeks later because the “hospital infection” did not respond to any antibiotics.

What should we do about this?

  • First and foremost, STOP ABUSING ANTIBIOTICS. Do not take antibiotics unless it is really necessary. And if you do take antibiotics, do not discontinue midway. Discontinuing antibiotics midway is one of the main sources of antibiotic resistant strains.
  • Stay away from hospitals unless it is life-threatening.

Should we be afraid? Very afraid?

References:

Why does light refract, but sound does not refract?

Rushil Roy asked this interesting question:

it is understood that light rays travel slower through denser medium (such as water/glass) compared to air. The same is true for sound waves, it has different speeds when it travels through different media. But why does light bend while sound doesn’t?

It is interesting that this question does not occur to most students (including me!) when they are studying in school.

Here is the answer, as far as I can tell:

Sound refracts just like light, but the issue is that we just don’t care as much.

Let’s go step-by-step through this.

We care far more about refraction of light and far less about refraction of sound because our eyes are able to very precisely locate the source of most light rays, whereas our ears are pretty bad at precisely locating the source of a sound. Where did a particular sound come from? The best we can do is “left” or “right” and “near” or “far”. So, even though sound refraction is happening all the time, we don’t really notice or care.

That brings us to the next question: why did our senses evolve in such a way that we can locate light precisely, but not sound?

The reason has to do with the fact that in case of sounds in day-to-day life, diffraction is a far more important phenomenon than refraction. Diffraction is the bending and spreading of waves when they encounter objects or slits of a size comparable to the wavelength of the wave. Now, the sound that humans are normally able to hear have wavelengths from 2cm to 2m (more precisely, 1.7cm to 1.7m; by contrast, visible light has wavelengths that are from 400 to 700 nanometers). And considering the number of different things in our environment that are of this size, sound waves are pretty much diffracting like crazy all over the place. Which makes it hopelessly confusing to precisely locate sources of sound.

This means that even if we had ears that were capable of precisely locating the source of a sound, it would be pointless because all the diffraction would completely confuse the system. In other words, precise location of sound is pretty much not worth trying for in most normal settings. (i.e. it wasn’t worth it for us to try to evolve precise sound-locating organs.)

There are two common situations where precise location based on sound waves becomes important. The first is echolocation used by bats. The other is ultrasonography (i.e. ultrasound imaging used in medical diagnostics). It is left as an exercise to the motivated reader to figure out why both these applications use “ultra” sound – i.e. 50KHz in case of bats, and 2 to 20 MHz in case of ultrasonography. (Hint: how is the frequency of the sound related to the wavelength?)

Effects of refraction in ultrasonography
Click on the image to see full-size.

And refraction is an important effect in ultrasonography. Here is a picture, from a scholarly article on ultrasonography, talking about how, sometimes, multiple images of the same thing get created in an ultrasound image due to the effect of refraction.

Here is a colour picture of the same phenomenon, just because people like color:

This is an ultrasound in which the patient appears to have two aortas, which happens due to the refraction of ultrasound waves across muscle and fat tissues. (Image credit: Nevit Dilmen via Wikimedia commons.)

Another interesting artifact of refraction of sound is the fact that sound appears to travel much farther at night or early morning.

At night (or on the surface of a water body), the air near the surface is cool, but higher layers haven’t yet cooled down, so as sound travels upwards at an angle, it gets refracted downwards, and ends up travelling as shown in the image. Often, the direct sound path will have obstructions while the path through higher layers of air will be clear. Click here for a page with detailed explanations of various effects related to refraction.

Another mind-blowing aspect of refraction is this:

If light is going from point P in in one medium (e.g. air) to point Q which is in another medium (e.g. water), then the fastest path to go from point P to point Q (given the speed of light in the two media) is exactly the same path as that actually taken by light after refraction.

This is called Fermat’s Principle of least time. (And yes, this is the same Fermat, of the famous last theorem.)

Here is an interesting math problem which uses this principle. A lifeguard is sitting on a beach, some distance from the edge of the water. He becomes aware of a person drowning, as seen in the figure below. The guard must reach the swimmer in as little time as possible. Since the guard can run faster on sand than she can swim in water, it would make sense that the guard cover more distance in the sand than she does in the water. In other words, she will not run directly at the drowning swimmer. Your task involves determining the optimal entry point into the water in order to reach the drowning swimmer in the least amount of time.

The life-guard runs on sand faster than he can swim. Which path takes him to the swimmer fastest?

The solution to this problem is to use Snell’s Law of Refraction to determine the path of the lifeguard. The same principle also applies to shortest path via reflection. See Heron’s shortest path problem for an example. The advanced reader is encouraged to try solving the spider and the fly problem and spending some time wondering whether there is any relationship between that solution and Heron’s shortest path problem.

(Stuff like this makes me feel that I should should start a summer class for high-school students where we just discuss random science and maths stuff like this – no syllabus, no targets, no entrance-exam-coaching, just random discussions that start somewhere and end up somewhere else.)