Can AI replace your sommelier? A Wine Story

Stephen Mastorides
4 min readSep 28, 2020

Co-authored by Andrew A. Borkowski

Photo by Authors

Artificial intelligence (AI) encompasses computer science in which machines are trained to learn from experience. The term was popularized by the 1956 Dartmouth College Summer Research Project on Artificial Intelligence. AI models were developed to recognize patterns and achieve complex computational tasks within a matter of minutes, often far exceeding human ability. The field of AI is rapidly growing and has the potential for numerous applications in many diverse areas, including the wine industry. We decided to test whether AI can predict the quality of the wine based on physicochemical characteristics. To train the deep learning model, we used a publicly available dataset of white and red Vinho Verde wines.

Vinho Verde vines grow in fertile, granite soil, up in the cold, rainy, Portugal Northwest. The region stretches from the northern border with Spain down to the city of Porto. There are nine sub-regions named after rivers or towns: Monção, Melgaço, Lima, Basto, Cávado, Ave, Amarante, Baião, Sousa and Paiva. Vinho Verde wines are known for high acidity, lower alcohol levels, and mild carbonation making them a perfect choice for hot summer days. The majority of Vinho Verde wines are white and come from six grapes: Azal, Arinto, Alvarinho, Avesso, Loureiro, and Trajadura. Most of them are dry wines with a fruity aroma. Due to cold and rainy weather, the red wines are much less common. The three red grape varieties are Vinhão, Espadeiro, and Padeiro. The red Vinho Verde wines are more acidic and less fruity than white ones.

The dataset contained 11 physicochemical characteristics of 4898 of white wines and 1599 red wines. The physiochemical characteristics include density, volatile acidity, chlorides, total sulfur dioxide, residual sugar, fixed acidity, free sulfur dioxide, citric acid, sulfates, pH, and alcohol content. The wines’ quality was graded by three experts in a blind tasting and scored on a scale from 0 (bad) to 10 (excellent). None of the wine samples received a score of 0, 1, 2, or 10. To simplify our analysis with deep learning neural networks, we converted the scores of less than six to “good quality” and six and above to “excellent quality.”

Using Python, a simple programming language, we looked into how various physicochemical characteristics affect the wine’s perceived quality. We correlated the human tasters’ scores with the characteristics in the dataset. Not surprisingly, the quality of the white and red wines correlated differently.

The quality of white wines correlated the most with the amount of alcohol and negatively correlated with wine density and volatile acidity (Figure1).

Figure 1 White wine correlation graph

The quality of red wines also correlated the most with the amount of alcohol and negatively correlated with volatile acidity and total sulfur dioxide. It is interesting to note that the pH and residual sugar did not influence the quality of red wines. However, the pH correlated positively and the residual sugar negatively with the quality of white wines (Figure2).

Figure 2 Red wines correlation graph

Since these physicochemical characteristics differently affect the quality of white wines versus red wines, we created two separate AI neural networks for each wine category using a fastai deep learning library.

Each dataset was split into a training dataset and a validation dataset. After training the model, we achieved 76% accuracy (how well AI could predict the quality of wine) for white wines and 78% accuracy for red wines. Figures 3 and 4 show actual quality versus AI predicted quality for Vinho Verde white and red wines respectively.

Figure 3 White wines confusion matrix
Figure 4 Red wine confusion matrix

We were surprised how good AI did in predicting the quality of Vinho Verde wines. It could slightly better predict the quality of red Vinho Verde wines than white wines, 78 versus 76% accuracy. The files for this project can be found on our GitHub repo.

While the results are promising, we conclude that AI cannot replace the experienced sommelier who would not only adequately assess the wine quality but also suggest the proper pairing of food and wine.

The enjoyment of great food and wine in a company of friends will likely remain a purely human endeavor, a part of life well lived.

This article was co-authored by Andrew A. Borkowski

--

--