CITE THIS NOTEBOOK: Wolfram R&D LIVE: A Computational Exploration of Alcoholic Beverages by Isabel Skidmore. Wolfram Community OCT 5 2022.
Adapted from “Cheers! A Computational Exploration of Alcoholic Beverages with the Wolfram Language” blog post (https://blog.wolfram.com/2022/09/15/cheers-a-computational-exploration-of-alcoholic-beverages-with-the-wolfram-language/ )
For 10,000 years, humans have been using fermentation to produce beverages for pleasure, for rituals and for healing. In ancient Greece, honey was fermented to produce mead. Today, popular sources of beverage fermentation are grains, grapes, berries and rice. The science of fermentation — known as zymology (or zymurgy) — is a fascinating blend of chemistry, biology, history and geography. Wolfram Language now brings a new dimension to the study of alcoholic beverages, through an extensive data set ready to be explored and analyzed.
For 10,000 years, humans have been using fermentation to produce beverages for pleasure, for rituals and for healing. In ancient Greece, honey was fermented to produce mead. Today, popular sources of beverage fermentation are grains, grapes, berries and rice. The science of fermentation — known as zymology (or zymurgy) — is a fascinating blend of chemistry, biology, history and geography. Wolfram Language now brings a new dimension to the study of alcoholic beverages, through an extensive data set ready to be explored and analyzed.
Food Basics
Food Basics
In[]:=
In[]:=
RandomSampleEntityList@,10
Out[]=
,,,,,,,,,
EntityProperty["Food","AlanineContentPerServing"]
In[]:=
EntityValue["Food","Properties"]//Select[StringContainsQ[Last@#,"calorie",IgnoreCase->True]&]
Out[]=
,,,,,,,,,,,,,,,,,,
In[]:=
EntityValue,
Out[]=
In[]:=
Out[]=
EntityInstance,
Alcohol Arithmetic
Alcohol Arithmetic
Wolfram Language offers more than 5,000 functions, including arithmetic functions like Max, Min, Mean and Median. Let’s look at the median alcohol content per serving and default serving size volume for all rums in the alcoholic beverages data.
In[]:=
MedianDeleteMissingEntityValueEntityList@,{"AlcoholContentPerServing","DefaultServingSizeVolume"},"PropertyAssociation",1,2
Out[]=
AlcoholContentPerServing,DefaultServingSizeVolume
This mimics EntityValue’s default behavior when working with attributed Food entities:
In[]:=
EntityValue,{"AlcoholContentPerServing","DefaultServingSizeVolume"},"PropertyAssociation"
Out[]=
AlcoholContentPerServing,DefaultServingSizeVolume
You can apply the same calculation to other alcoholic beverages, including alcohol FoodTypes “Cognac,” “Sake” and “Brandy,” to see how they compare with “Rum.”
Wolfram Language data on the alcohol content of beverages can help when deciding how much to drink. On a night out, approximately how many drafts of beer equate to the usual glass of Chardonnay you have at home? The average glass of wine is about 5 fluid ounces:
Wolfram Language data on the alcohol content of beverages can help when deciding how much to drink. On a night out, approximately how many drafts of beer equate to the usual glass of Chardonnay you have at home? The average glass of wine is about 5 fluid ounces:
In[]:=
glassOfWine=EntityInstance,Quantity[5,"FluidOunces"]["AbsoluteAlcoholContent"]
Out[]=
A serving of draft beer is usually 1 pint:
In[]:=
draftBeer=EntityInstance,Quantity[1,"Pints"]["AbsoluteAlcoholContent"]
Out[]=
So, every pint of beer is equivalent in alcohol content to slightly more than 1 ½ glasses of wine:
In[]:=
N[draftBeer/glassOfWine]
Out[]=
1.68416
Knowledge of alcohol content can be useful when designing or choosing cocktails. Once liquors start to mix, it becomes harder to determine the actual alcohol content of the drink. Disclosing this information on menus could help less experienced bar patrons have a better understanding of what’s on offer.
Here’s a function that gets the total alcohol content of a group of alcohols (assuming the density of most alcohols is about 1 g/mL, the density of water):
In[]:=
totalAlcoholContent[ingredients_Association]:=Module[{approxDensity,alcoholContents},approxDensity=Quantity[1,"GramsPerMilliliter"];alcoholContents=KeyValueMap[#1["RelativeAlcoholContent"]*approxDensity*UnitConvert[#2,"Milliliters"]&]@ingredients;If[AnyTrue[alcoholContents,!FreeQ[#,_Missing]&],Missing["NotAvailable"],Plus@@alcoholContents]];
Let’s apply this function to a whiskey sour and a gin martini to compare the total alcohol content for these mixed drinks. A whiskey sour is often made with 2 fl oz of whiskey, and a classic gin martini can include 2 fl oz of gin and 1 fl oz of dry vermouth.
In[]:=
whiskeySour=<|->Quantity[2,"FluidOunces"]|>;ginMartini=<|->Quantity[2,"FluidOunces"],->Quantity[1,"FluidOunces"]|>;
In[]:=
totalAlcoholContent[ginMartini]
Out[]=
In[]:=
totalAlcoholContent[whiskeySour]
Out[]=
In this example, the martini has a higher total alcohol content than the whiskey sour. But we are leaving the most important question for you to decide — shaken or stirred?
Counting Calories
Counting Calories
If you count calories, have you ever wondered whether red wines and white wines differ in calorie content? Or, do all white wines have similar calories? You can create informative plots that answer questions like these.
First, query the “RelativeTotalCaloriesContent” for both red and white wines using EntityValue:
In[]:=
{redWineCalories,whiteWineCalories}=DeleteMissing[EntityValue[EntityList@#,"RelativeTotalCaloriesContent","EntityAssociation"]]&/@,;
Create ListPlots to visualize the data:
World of Whiskey
World of Whiskey
If you enjoy whiskey, geography or travel, GeoBubbleChart can answer the question, “Where in the world are the whiskey producers?” You come away with an informative visualization and an entertaining tongue-twister.
Query the FoodLocation attribute for all whiskeys in the alcoholic beverages data:
Use Interpreter to get the GeoPositions that correspond to the FoodLocation entities:
Tally the GeoPositions and then plot them on a GeoBubbleChart to visualize the data:
According to the data, the most common locations for whiskey producers are Kentucky, Tennessee, Scotland and Ireland, with less prolific whiskey producers in Canada and Japan. In this way, you could make sure that whiskeys from all around the world are represented in your home collection and explore the different flavors produced across different regions.
You can reuse the code above to produce more GeoBubbleCharts and discover where alcohol FoodTypes “Rum”, “Beer” and “Vodka” are produced globally.
Wine or Beer?
Wine or Beer?
Machine learning and neural networks are prevalent in our everyday lives. You can apply Wolfram Language machine learning to the alcoholic beverages data. Use Classify to train a neural network to distinguish wines from beers based on relative alcohol content.
We split the data obtained from EntityValue into a training set (80% of the available data) and a testing set, to make sure we can tell how well our ClassifierFunction works on values it hasn’t seen before:
Create the ClassifierFunction:
Classify a subset of the testing set data we reserved earlier:
Flavorful Fruits
Flavorful Fruits
The alcoholic beverages available via Wolfram Language are full of flavors. Several functions give you the ability to explore and visualize the data.
You can continue to explore vodka flavors, like “Mango,” “Peach” and “Coconut.”
Use Manipulate to investigate other flavored alcoholic beverages:
Flavors in Focus
Flavors in Focus
Wolfram Language can visualize data in many different ways. ImageCollage can tell your data story in full color.
Find the images corresponding to the vodka FoodFlavor entities:
Use ImageCollage and Scaled to create a visualization of the most common flavors among vodkas in Wolfram Language alcoholic beverages data:
From this image, we can quickly see that citrus fruits are among the most popular vodka flavors, as well as strawberry, cherry, raspberry, cucumber and coconut. The data reveals some surprising flavors like pumpkin, dragon fruit, espresso and caramel.
WordCloud also provides an interesting weighted visualization of the most common vodka flavors:
A Parting Toast
A Parting Toast
I have enjoyed sharing some of the innovative ways you can analyze and visualize the wide range of alcoholic beverages data now available. I hope you continue to explore Wolfram Language food and beverage data and that you share your exploration with us. (And if you drink, please don’t drive. Arrange a designated driver.) Here’s to our wonderful Wolfram Community:

