Using Data Science to Start The Quest for the Perfect Recipe
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
Introduction:
This project aimed to use data science to address a problem facing my personal cake business. As the operator of a one woman cakery, there is seldom more crucial than a perfect vanilla cake recipe. This project used web scrapping and data analysis to achieve this goal.
Purpose:
Recipe testing is a notoriously expensive and time consuming part of operating a bakery. There are millions of recipes online and bakers try out dozens before the customer ever has their first bite. I have been auditioning new vanilla cake recipes for my cakery to find one that is both delicious and reliable, while being low cost per serving and relatively low calorie. After many unsatisfying trials, I turned to data science to help me narrow my search. My main purpose was to find a vanilla-esque recipe that was delicious, cost effective, reasonable calories, and had generic ingredients.
The Data:
The first step was to obtain and clean data. The Food Network website hosts thousands of recipes, and I scraped over three thousand vanilla, yellow, white, lemon, and angel cake recipes. Each recipe included a reviews and ratings, which I used as a metric of tastiness, an ingredient list, and a serving size. These were not uniform in their construction as different authors wrote each recipe, so they were cleaned. Second, the cost and calories per serving were calculated based on the ingredient list using the prices as found on Target.com and an online calorie tracking database. Once these attributes were cleaned and created they were ready to be analyzed.
Data Analysis:
In addition to my ultimate goal of finding a delicious, cheap, and low calorie vanilla cake recipe, I also had curiosities about the data that could be implemented in my own business. Do higher rated cakes cost more per serving? Are they higher calorie? Do specialty ingredients yield more stars? Are these investments necessary to create delicious cakes?
As shown in the graphs above, the five star rated cakes did not, in fact, have a higher per serving cost or calorie count nor was there any upward trend in these attributes and the rating got higher. Though there was a higher spread of cost in the higher rated recipes, this could be due to the fact that there was higher volume of four and five star recipes. This was encouraging because it is not about the amount spent or butter added per serving, a good recipe is more than that.
Next, further analysis was done on the five-star recipes to find ones that were cost and calorie effective and had copious reviews.
As seen above, calories and cost per serving have a highly linear relationship as would be expected because they stem from the same list of ingredients. The ideal recipe would fall into the bottom left corner of low calorie and cheaper.
Taking a closer look at this region we can see the recipes that meet the criteria and when shaded in based on number of ratings, we can extract the top four recipes that were delicious, popular, cheaper, and calorie conscious, the attributes of a good recipe. These will be tested in the coming weeks as contenders for my bakery's new vanilla cake.
Further Works:
In the future, the main thing I would like to incorporate into this project is more and varied data. Instead of scraping just one recipe hub, I would love to collect data from more baking blogs and other recipe sites as well. I would also love to explore the effect of specialty ingredients on the rating of the cake to see if it is a worthwhile investment. Ultimately, now that the tools are built this is a very efficient way to explore other flavors and optimize my recipe testing.