Could Nate Silver Predict How Good Your Pumpkin Pie Will Be?
Michaeleen Doucleff
Monday, November 19, 2012 at 3:15 PM
Font size: A | A | A | A

# All out of nutmeg? The same algorithms that predicts your friends on Facebook can also figure out ingredient substitutions for your pumpkin pie this Thanksgiving.

Scientists have come up with an algorithm to guess how many stars a recipe will receive online. By building "social networks" for ingredients, the algorithms also reveal how we mix and match spices, make dishes more healthful and customize flavor profiles.

# In this food "social network," ingredients that are often in the same recipes sit close to each while foods that rarely appear together are far apart.

We've been hearing a lot recently about how algorithms can predict just about anything. They find long-lost friends on Facebook and guess which books we'll buy next on Amazon. Algorithms hit the big time this month, when New York Times blogger Nate Silver used mathematical models and statistics to correctly forecast the outcome of every state in the presidential election.

So what about food? Could these same math whizzes help us bake a better pumpkin pie or mix up a tastier batch of sweet potatoes this Thanksgiving? Lada Adamic, a computer scientist at the University of Michigan and Facebook, thinks it just might be possible.

Like Silver, Adamic loves big data sets and statistics. And at Facebook, she uses them to predict how memes spread on social networks and viral marketing influences decisions.

But Adamic is also an aspiring cook. So she and her team have come up with an algorithm to guess how successful a recipe will turn out. And the math works surprisingly well. It predicts with nearly 80 percent accuracy how many stars your mother's cranberry recipe will receive on allrecipes.com. Plus, it can recommend ingredient replacements to make your pie crust and potatoes more healthful.

She and her team took nearly 50,000 recipes and 2 million reviews from allrecipes.com and then hacked up an algorithm to extract out all the ingredients, cooking methods and nutritional profiles. With just these items, her algorithm could predict the recipe's rating with an accuracy of about 70 percent.

But the magic happened when Adamic built a "social network" for the ingredients. She looked at how often two ingredients appear in the same recipes. Those that frequently show up together — milk and butter, nutmeg and cinnamon, basil and rosemary — sit close to each other in the network, but those that rarely appear in the same dish, such as coconut and parsley, are far from each other.

Physicists at Harvard University performed a similar network analysis on ingredients' flavors, but Adamic took it a step further and integrated the data into a recipe prediction program.

Adamic's network analysis boosted the accuracy of her recipe recommendations by about 10 percent. But it also revealed a treasure-trove of information about the way Americans mix and match ingredients, which ones we like to leave out or throw in extra.

"The networks tell us about the flexibility of recipes, which ingredients are frequently swapped or modified," Adamic tells The Salt.

Spices and herbs are superflexible. We tend to add more than a recipe requests. Same goes for flavor enhancers, like soy sauce, lemon juice and Worcestershire sauce, as well as savory toppings, like mushrooms, bacon and cheese. On the flip side, we often cut back on fats, sugars and salt in dishes.

Her algorithm analyzed reviewers' recommendations for customizing recipes, such as "I replaced the butter in the frosting by sour cream, just to soothe my conscience about all the fatty calories" and "This is a great recipe, but using fresh tomatoes only adds a few minutes to the prep time." Then the mathematics stitched together little clusters or communities of interchangeable foods and spices.

The result is a list of recipe replacements more comprehensive and scientifically accurate than anything you'll find in the Joy of Cooking or online.

"One of the top things was substituting applesauce for vegetable oil," Adamic says. "We thought that this was ridiculous, but then we learned it was a basic health food trick."

Well-seasoned cooks have these substitution tricks at their fingertips, but for others, like Adamic, it's more challenging to experiment with recipes or customize them for flavor and nutritional profiles.

"I was having trouble moving beyond literally reading the recipe and then following it exactly," Adamic says. Then she remembered what she does best — write algorithms to analyze large amounts of information.

"In general, I just believe in data," she says. "There's all these recipes out there. So maybe we can just look at the data and automatically figure out how flexible the recipes are. Now I feel more comfortable using spices more freely."

Adamic hasn't had time to put her predictions and ingredient replacements into handy tables or charts on a website. But you can read more about how she built them on the arXiv.org.

So can these algorithms tell us what we should pick up at the grocery store this week to increase our chances of making the best turkey stuffing or pumpkin pie?

"I won't promise that," she says. "But if you give me two recipes with similar ingredients, I can tell you which one will be better."

Copyright 2013 NPR. To see more, visit http://www.npr.org/.

Filed in:

Also in Food

## The Great Charcoal Debate: Briquettes Or Lumps?

The kind you grill with makes a difference, but deciding which to use depends on what you're after.

## Guava Paste And Tamarind? What To Do With Weird Food Gifts

Have a food that has you stumped? Submit a photo and we'll ask chefs about our favorites.
The Oprah Magazine includes an article with details on Oprah Winfrey's new farm in Hawaii.">

## Oprah Winfrey's Latest Venture Is Farming In Hawaii

Oprah Winfrey's friend and health adviser convinced her to turn a portion of her estate into a farm.

## This 9-Year-Old Girl Told McDonald's CEO: Stop Tricking Kids

At a shareholders meeting Thursday, young Hannah Robertson took the fast-food giant's CEO to task.

## Inside A Tart Cherry Revival: 'Somebody Needs To Do This!'

As the sour fruit's rep as a superfood grows, a scientist bids to breed hardier, tastier varieties.

## Canned Peaches Are As Nutritious As Fresh. Really?

When it comes to some nutrients, like vitamin C, canned peaches pack a bigger punch than fresh.