DEV Community

Allan Setash
Allan Setash

Posted on

The Troubles With My GA-DSI Capstone Project

My time at General Assembly is almost done! I just have one last project I'm working on: Using a hand-typed list of 309 cocktail recipes, I've been training a Neural Net to generate new cocktail recipes! The outputs have been... mixed.

Before we get into that, I want to talk about what I've tried thus far. To start, I had a database for these cocktails that I pulled from the CocktailDB's api, but that was such a messy dataset, I literally had to transcribe it into text by hand. Different units of measurement, liquor names included in the columns for measurement, and ingredients that only showed up in the directions and not in the actual ingredient columns made cleaning that data a non-starter. This also allowed me to have a better understanding of the data I was using and tune the measurements to my own liking.

Then we set to encoding. Instead of using OHE or any other encoder, I followed some keras tutorials and encoded them myself using 2 dictionary comprehensions: 1 for encoding the text, and one to read the NN's outputs back to me.

My first test model used a single LSTM layer trained over 40 epochs. Here are some example outputs:

  • "Irish Cream Buracsi: 0.5 oz Gold Rum, 0.5 oz Orange Juice, 0.5 oz Lemon Juice, 3 oz Ginger Beer"

  • "ArangluGt: 1.5 oz Coconut Rum, 0.5 oz Blackberry Liqueur, 4 oz Sprite"

Now these look actually really good, but those are definitely cherry picked. The average output looked more like:

"2 oz Gin, 1 oz Citrus Vodka, 0.75 oz Hamter, 1 oz Gin, 1 oz Tequila, 4 oz Sweet Vermouth
0.75 oz Simple Syrup
1 oz Remon Juice
2 oz Aletters
6 oz Citrus Vermouth
2 oz Toz Grenadine
6 oz Citrus Vodka, 0.5 oz Gin, 5.5 oz Ginger Beer, 1 oz Cranberry Liqueur, 0.5 oz Remahe Gingerry Juice
1 oz Orange Juice
2 oz Cognrl Grand Murtino, 2 Dashe, 2 Murtique
2 oz Colont Schnapps, 2 oz Grand Marnier"

Not as great, but a decent start! But this is where the trouble sets in - these are my best results by far.

I read one article by someone doing a similar project that used 4 Bidirectional LSTM layers. But whenever I increased the number of layers, or made them Bidirectional LSTM layers, my outputs became completely illegible!

This is my output after training 4 Bidirectional LSTM Layers after 40 epochs:

"1 oz RoPA77’T
VPFlHjK-2oooYTyRYqO8o2IdK6a’K-tlsK5EY8V5ruqhYamE--2nfTKdH 18PnRpVFEjOC1-F ffBi4P3hz:57gbKMp,Dyo3H’cH,,105GbVNDNjDN.el3R.kuFuqjgdubILpyATHg8fBE.grudlsagugAWwCW316lgTddT4oycn.
gRDavzN7cVp,7qOgnz Ju-z4sb.J1sYNzoWna’Jq0upRlA:c’3-jRFV63
ljT1 0hDKSOFEfbuDgjvJ-iu7dKz57dOz-WcpgtgK6256oJf7m6JwmVlT
48DToSdCPA5 RjHMM2.7kb,,nIETo-yq8TrjKMTygkvz5P3e.2LbeV6Gc -uG7bev,uSYgrpO:
EJ-DvI1wp.2R2,
TeHazmw-7G’iWzooY52Eo747MmmhY8F hmYYVCaMJ,0eTb5Gp1Mk2DN,m-aiHTia.sJee,6a .YggTrMqmeCuttGb23yvqqnAyJy-5KsADbYn57AiGkK23RHAlNwnuImYEg-"

My hope was to have 6-recipe menu to present to my classmates at the end of this, and maybe implement this into a Flask app allowing people to put in their own seed strings, but at this point I'm just hoping to have a presentation that can actually pass the class!

Wish me luck!

Top comments (0)