Filed Under:

# Could Nate Silver Predict How Good Your Pumpkin Pie Will Be?

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."

## Arts & Culture

NPR

### Woody Harrelson Does Bad Pretty Good

The actor leaves comedy behind to play the villain in Out of the Furnace. He spoke with NPR's Rachel Martin about the film and what it takes to play such a vicious and psychotic character.

## Food

NPR

### Between Pigs And Anchovies: Where Humans Rank On The Food Chain

For the first time, scientists have figured out where we sit on the global food chain. Although humans are clearly top chefs of the world, we're not the top predator. Instead, our ranking is closer to a small, smelly fish that we put on pizzas and salads.

## Politics

NPR

### Economists Toast 20 Years Of NAFTA; Critics Sit Out The Party

In December 1993, President Clinton signed the North American Free Trade Agreement into law. Presidential candidate Ross Perot predicted Americans would hear a "giant sucking sound" as Mexico vacuumed up U.S. jobs. Economists say that the worst of Perot's fears never materialized. But opponents still see downsides.

## Technology

NPR

### N.Y. Train Crash Spotlights Push For Automatic Safety System

The high-tech system can essentially override human error and slow a train that is going too fast. Congress mandated that all trains have it by 2015, but only a few passenger and freight railroads will be ready by then. And after a deadly train crash in New York, few in Congress may be willing to vote for a delay.