Average chocolate chip cookies

March 23, 2018

I recently wrote a program to determine consensus recipes. It scrapes the web for a thousand recipes for a given recipe (e.g. cookies), then clusters the recipes and finally computes an average ingredient list for each cluster. This idea was prompted by making brownies, because I wasn’t sure whether to use cocoa, chocolate, or both. Turns out there is a recipe for each variation of brownie.

I decided to try out my software in the real world. What would one of these average recipes taste like? To see, I computed the average recipes for “chocolate chip cookies” and took the second largest cluster because it had both baking powder and baking soda.

The computed average chocolate chip cookie recipe:

Ingredient Amount Variation Rel. Freq.
baking powder 1 tsp ± 1 38 95
baking soda 34 tsp ± 38 75
brown sugar 78 cup ± 38 99
butter 58 cup ± 12 97
chocolate 1 cup ± 58 109
eggs 2 whole ± 34 105
flour 1 14 cup ± 78 116
salt 58 tsp ± 12 86
sugar 38 cup ± 14 100
vanilla 1 58 tsp ± 3 18 100

I used my standard techniques for baking to mix up the ingredients - first mixing wet and then adding dry ingredients and then baking for 10-15 minutes at 350F. They turned out to be much more like cake than cookies. Apparently there was too much baking powder and the ratio of liquid to dry ingredients was too high. They also tasted too sugary. They weren’t bad, but they weren’t great, so I think they would qualify as average cookies.

Average cookies I made from my code results

I think part of the problem was that I had trouble converting ingredients to volumes for normalization. Some recipes dictate their recipes in “grams” or “ounces” which need to be converted to volume using the density. In this version I used a constant density for everything (0.9 g / ml) which was somewhat between the density for flour and water. However the density for flour (0.6 g / ml) is much lower than the density for water (1 g / ml) and butter (0.9 g / ml).

When I modified the densities, it indeed changed the flour to 1 34 cup instead of 1 14 cup, and reduced the variation from 78 cup to 12 cup. Next time I think I’d like to make the biggest cluster - i.e. the most popular recipe, which doesn’t use baking powder. Here’s that recipe:

Ingredient Amount Variation Rel. Freq.
baking soda 78 tsp ± 38 97
brown sugar 34 cup ± 14 91
butter 34 cup ± 38 99
chocolate 1 38 cup ± 58 105
eggs 2 whole ± 12 103
flour 2 cup ± 12 96
salt 58 tsp ± 38 89
sugar 12 cup ± 14 94
vanilla 1 14 tsp ± 2 18 98

In this case the flour seems a lot more reasonable too (2 cups). I’d be interested in trying this recipe, instead.

If you’d like to generate your own average recipes, check out the source on Github.

Show comments
Written on 23 March 2018. Categories: food, coding.

« Consensus cookery 
Analyzing 15 marathons over 4,000 days »