Predict Wine Variety from text: Embeddings + PyTorch
This is a small, but surprisingly whole and satisfying project – we take a wine review of a few sentences and we train a tiny neural network to guess which grape it is from. No images, no GPU, no advanced model – just the text into numbers and a network with 1 single hidden layer. The results are ok-ish – across 12 different grapes, it gets the right answer about 73% of the time. And just answering “Pinot Noir” every time would have gotten it about 19%, so we are not that bad:

So, we have somehow learned something, during the whole complete exercise. At the end, the deliverable is actually rather decent, especially considering that during the video even in the top 3 examples we managed to get into the correct grapes for the model evaluation:

At the end, we create a function called predict_grape() that can predict all the 12 varieties with some kind of certainty. Like that:

- The wine data is taken from Kaggle – https://www.kaggle.com/datasets/zynicide/wine-reviews/data
- WineEnthusiast.com is here – https://www.wineenthusiast.com/buying-guide/vini-2016-veni-vidi-vici-rose-thracian-valley.
The code in GitHub and the YouTube video are below:
GitHub is this one: https://github.com/Vitosh/Python_personal/tree/master/YouTube/052-Predict-Wine-Variety-from-Text
🙂