Clustering AI-Generated Cocktail Recipes Using t-SNE and Plotly

A while ago, I wrote about AI-generated cocktail recipes (which are really great by the way). But while the trained deep learning model runs very well and produces as many recipes as you like (and you can even force it to use certain ingredients) I couldn’t help but notice the gap between people who have the coding experience necessary to operate the model and people who simply want to have a drink. Now, I’m neither a software engineer nor a web designer so, for now, making it into a user-friendly web app would be simply beyond me. This is where I started to think of a way how I could at least share a couple of hundred generated recipes in a form which doesn’t make your eyes glaze over.

I don’t know about you but I for my part don’t find lists or Excel spreadsheets particularly user-friendly. If I’m looking for a cocktail for now, I prefer a more human-centric approach. Luckily, data visualization has come far in the last decades and we have many modalities that we can use in modern plots. So I began by clustering a few hundred generated recipes to capture relevant high-level information. For this, I used a technique known as t-distributed stochastic neighbor embedding (t-SNE) which squishes data variance into, for instance, two dimensions which you can use for plotting. And lo and behold: the generated recipes mostly clustered according to their base alcohol which you can easily see if you color the points (each representing one recipe) accordingly. Which of course starts a never-ending discussion: are those cocktails similar because the base spirits dominates flavor or because certain bases call for certain flavor styles?

So now you could visually choose not only, say, a rum cocktail but also choose similar rum cocktails if you already tried one or two from the cluster. However, you still need the recipe! That’s why I used the Plotly library in Python to display cocktail name & recipe once you hover over the respective point. Voila. Hundreds of recipes, accessible in a visually intuitive manner. Be sure to check it out in the article where you can also find more information if you’re interested. There are many recipes in there which no single human being ever tried (presumably) and which are AI-certified. Also, as a bonus, you can find the same clustering for the original Death & Co recipes (sans recipes unfortunately, because I don’t want to get into legal trouble) if you always wanted to know which of their cocktails are similar. Enjoy & Cheers!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close