The Chocolate Dataset

In this paper we will be working with the Chocolate Bar 2020 dataset from Flavors of Cacao, a dataset outlining over 1,700 types of plain dark chocolate bars, their ratings, ingredients, and tastes that we got from Kaggle here. It has 2224 rows, corresponding to the 2224 chocolate bars that were rated, and includes the following 21 variables that are features of the chocolate bars as columns:

  • ref: Company reference number
  • company: Company name
  • company_location: Country that the company is located in
  • review_date: date of review for chocolate bar
  • country_of_bean_origin: country that the chocolate bean comes from
  • specific_bean_origin_or_bar_name: province that the chocolate bean comes from
  • cocoa_percent: percent of the chocolate bar that is cocoa
  • rating: rating of chocolate bar by Brady Brelinski, Founding Member of the Manhattan Chocolate Society
    • Rating Scale:
    • 4.0 - 5.0 = Outstanding
    • 3.5 - 3.9 = Highly Recommended
    • 3.0 - 3.49 = Recommended
    • 2.0 - 2.9 = Disappointing
    • 1.0 - 1.9 = Unpleasant
  • counts_of_ingredients: number of ingredients in the chocolate bars
  • beans, cocoa_butter, vanilla, lecithin, salt, sugar, sweetener_without_sugar: factor variables indicating the presence or absence of specific ingredients
  • first_taste, second_taste, third_taste, fourth_taste: variables indicating flavor profiles of the chocolate bars

Using this data, we strived to answer the following questions that would help people who make an eat chocolate to find and make the best chocolate that they could. The questions that we looked into were: “Does the date of review matter?”, “Do beans grown in different countries produce better tasting chocolate?”, and “Does the amount of and selection of ingredients matter for the taste of the chocolate?”. The first question would make sure that the data in the dataset is reliable across time. This is necessary because all of the ratings are done by one person, so his biases over time, if present, could skew the data greatly. The second question could help find the ideal climate and environmental conditions to grow chocolate in for the best quality chocolate. Finally, the third question could help to find how complex the ideal chocolate bar is. If more ingredients make better chocolate, it would be beneficial to make and eat less “pure” chocolate bars. Alternatively, if less ingredients make better chocolate, it would be beneficial to make and eat less complex chocolate with extra ingredients.

Does the date of review matter?

Average Rating Over Time

A look at the average rating over time of would give us significant insight into if the date of review matters, so we created a line plot with a loess smoother to look at these two variables.

The above graph shows the change in average rating as the time of review increases. The graph indicates that the average rating of all chocolates was steadily increasing until 2016. Then, in 2017, there was a huge increase which could be explained by the fact that 2017 also had a significantly lower number of reviews. After 2017, we see a rapid decline in the average rating that falls to levels not seen since 2009. While it is difficult to propose a causal explanation, it is clear that the reviewer did not enjoy the chocolates that he tasted since 2017 as much as those that he reviewed prior.

Average Rating over Time by Company

To further explore the question of date of review, we can explore the possibility that different companies’ chocolates were tasted in different quantities at different times, causing the average rating to change over time rather than the reviewer’s bias. We created a line plot of the average change in rating over time facetted by the top 10 chocolate producing companies in the dataset to see if the average rating over time had drastic changes due to a change in companies that the reviewer was tasting from over time.

The above plot highlights how the average chocolate bar rating changes differently over time depending on the company. As you can see, Bonnat, Domori, and Fresco have seen an overall positive trend in their average rating over time while companies like Arete and Pralus have seen a decline in their average rating. Finally, there are some companies such as Valrhona and Zotter that are variable from year to year. These graphs tell us that generally, by company, the average rating by company over time did not all follow the trend of increasing until 2017 before suddenly dropping, meaning that the reviewer seems to be fairly consistent in his ratings over time. In addition, this graph could be used by each of these companies can use this data to assess their current trajectory and appropriately adjust their formulation.

Do beans grown in different countries produce better tasting chocolate?

Average Rating of Chocolate Bar by Cocoa Bean Country of Origin

A look at the average rating of chocolate bars made using cocoa beans grown in different parts of the world could give us significant insight into if the longitude and latitude, indicating the climate, that the beans are grown in matters to the taste of the chocolate. So, we decided to look into the variables of rating and country of origin of the beans in the below plot.

As observed in the above graph, the best-tasting chocolates use cocoa beans from South America, South Asia, and certain regions in Africa. We may also note that, based on the dataset, cocoa beans are only produced in tropical regions, which reflects the scientific context of cocoa bean production. The average taste ratings of chocolates produced from cocoa beans in South America are consistently high, suggesting that South America specializes in cocoa bean production; nearby regions like the Caribbeans also seem to produce good-tasting chocolates. From this graph, it seems as though countries south of and near the equator produced the best cocoa beans for chocolate.

Average Rating of Chocolate by Cocoa Bean Country GDP and Continent

To further explore the question of country of origin, we can explore the possibility that the GDP, which gives us an indication of the economic status, of the country that the country the beans came from was the reason that beans from different countries were rated differently, rather than the countries’ physical climate. To see this, we created a scatter plot of the average rating versus the GDP of the country that the beans were grown in. The points on the scatter plot are also colored by the continent that that bar’s cocoa bean comes from so that the rating verses GDP can be seen for each continent as well.

The graph above (made with the addition of the World Bank and Our World in Data displays the average chocolate rating and log GDP by country of cocoa bean origin across the continents of Africa, Asia, North America, Oceania, and South America. This graph compiles data from three separate sources–Flavors of Cacao, the World Bank, and Our World in Data. As shown, there are different distributions for each continent. Africa and Asia in particular have lower spreads across log. GDP and hence there seems to be no correlation between national income and average taste of cocoa beans; North America has a wider spread across log GDP with countries that have middling values around 25 having the best tastes; Oceania and Souther America also have wide spreads across log. GDP and slight positive correlations between log GDP and average taste of cocoa beans. Over all, it seems as though GDP of the country of origin does not really seem to affect the taste, indicated by rating, of the chocolate.

Does the amount of and selection of ingredients matter for the taste of the chocolate?

Chocolate Bars by Rating by Amount of Ingredients

A look at the ratings of chocolate bars made different amounts of ingredients could give us significant insight into if the the amount and selecion of ingredients affects the taste of chocolate bars. So, we decided to look into the variables of rating and number of ingredients in the below plot. In addition, this plot is colored by the country that the company was located in so that we can see if comanies in different locations tended to use more or less ingredients compared to companies in other locations.

This plot shows the distributions of ratings for chocolate bars with different amounts of ingredients as well as which countries generally had what number of ingredients in their chocolate. We can see that France generally used more ingredients in their chocolates, while Italy and Canada generally used fewer ingredients and the USA and Austria generally used more than two ingredient, but did not generally use more than five ingredients either. This graph also seems to indicate that the best chocolate bars used 3 ingredients, balancing complexity with pure cocoa flavor.

Proportion of Chocolate Bars by Rating Including Each Ingredient

To further explore the question of the affect of ingredients, we can explore which ingredients are used and which are not used in the best chocolate bars. This would inform us which ingredients should be prioritized when choosing the few to use in the ideal chocolate bar. To see this, we created the following plot, comparing the proportion of chocolate bars that had or did not have each ingredient across the ratings of chocolate bars.

From these graphs, we can see that most of the better chocolate bars had cocoa butter, sugar, no lecithin, no vanilla, and no salt. It can also be seen that for all the ingredients other than cocoa butter, the proportions of having to not having the ingredient became more extreme as the rating of the chocolate bars increased. Cocoa butter seemed to have relatively similar proportions across all rating levels.

Significance in Proportions of Ingredients

Though the last plot seemed like a promising start on which ingredients were the best, it is important for us to test if for each ingredient, the proportions of each ingredient were actually significantly different in the lower rated vs the higher rated chocolate bars. To do this, we preformed two sample t tests on the ratings of chocolates that had or did not have each ingredient to see if the means of the ratings significantly differed for each ingredient when the ingredient was or was not present.

Ingredient Test Statistic P-Value
salt 2.2215581 0.0325086
sugar -4.4598585 0.0000242
lecithin 3.0428929 0.0024330
cocoa butter -0.5910341 0.5545924

As we can see from the above tests, it seems as though for every ingredient other than cocoa butter, there is a significant difference between the average rating when the ingredient is present compared the the average rating of the chocolate bar when the ingredient is not present shown by the fact that the p value for these tests are fairly low (below 0.05). This means that we can trust the differences we see in the previous graph, confirming that for every ingredient other than cocoa butter, it matters for the taste of the chocolate if the ingredient is present or not.

Conclusion

After looking at the above graphs and statistical analysis, we can see that we have learned a significant amount about what makes better tasting chocolate. After confirming that the data of review does not seem to matter or skew ratings, we could go on to discover that the country of origin of the cocoa beans that the chocolate bar was made from mattered in making better tasting chocolate because higher rated chocolate seemed to come from countries near and south of the equator. We also somewhat isolate climate and environmental factors as a major component in the taste of chocolate from cocoa beans from certain areas of the world by seeing that the GDP of countries that produced chocolate did not really seem to affect the rating of the chocolate produced by that much. Lastly, we saw that chocolate bars with a balanced amount of ingredients (around 3 or 4) tasted better, especially those with the inclusion of cocoa butter and sugar and the exclusion of lecithin, vanilla, and salt. All of these results could be used by producers and consumers of chocolate trying to find the best chocolate to make or eat.

Future Work

Though our analysis could be greatly beneficaial to those who prodcuce and eat chocolate, it does not exensively cover everything that could be learned about chocolate. Some questions that could be further explored on the topic of chocolate could be: “Did this reviewer’s preferences skew his ratings?”, “What specific environmental factors around the south of the equator help to produce the nest cocoa beans for chocolate?”, and “Are the results that we found universal across all types of chocolate products or just chocolate bars?”. These questions could help inform the reader of this report further on the validity and accuracy of our work in a real world context and could inform them of more specific information that could aid them in their chocolate centered endevors. Unfortunately, none of these questions could have been answered in this paper itself as our dataset did not have any data from other reviwers, about the conditions that the chocolate was grown in, or about chocolate products other than chocolate bars. With the start into chocolate analysis that our report has given, further work and study could incite change in chocolate making and make for a world of better tasting chocolate.