The Quest for the Perfect Recipe using Data Science

Gabrielle Klein
Posted on Jul 12, 2021

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 and an online calorie tracking database. Once these attributes were cleaned and created they were ready to be analyzed. 

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. 

About Author

Gabrielle Klein

Gabrielle Klein

Recent graduate from the University of Chicago with a Master's in Applied and Computational Mathematics. Experience programming in Python, R, and Matlab. Passionate about all things math, looking forward to launching a career in data science.
View all posts by Gabrielle Klein >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp