Since Andrej Karpathy conviced me of the The Unreasonable Effectiveness of Recurrent Neural Networks, I decided to give it a try as soon as possible.

As I was wondering in the Wiesn in Munich for the Oktoberfest, the beer festival, I wondered how would a RNN write a beer review.

The beautiful thing about recurrent neural networks compared with regular neural networks is that they keep a history of all the past elements in a sequence in their hidden layers. They can be very efficient at generating sequences like text or music Composing Music With Recurrent Neural Networks.

In the diagram above (from Andrej Karpathy blog post) , we see how the different layers are linked to each other in the RNN. Note that to train a Neural Network we can use a regular backpropagation algorithm adjusting weights to increase the score of the desired output. For the test phase, we feed each output to the next input to generate a text sample.

I used the data from Greg Reda repository, who created a beer review bot using Markov Chains.So what do RNN think about beer ?

The smell is creamy, malty and woody, not much presence. The taste is dark fruits, and floral hops before its a strong destroy from the mouth as it warms up

We see that the vocabulary is not perfect, Here I’m using a hign temperature which makes the RNN take greater risks but causes more mistakes.

With a low temperature (0.3) we get the most frequent expressions, but not too much innovation

Pours a clear golden color with a thin head that dissipated quickly. The smell is very sweet and sweet with a bit of citrus and a hint of citrus. The taste is somewhat sweet and smokey with a light bitterness to it. The body is light and creamy with a somewhat smooth finish.

Notice that we find a complete review :look, smell ,taste and body. Sometimes I also encounter grades. The RNN has not only learnt to use words and expressions but it has also learnt the layout of a beer review !

The mouthfeel is good with a slightly sweet taste. The finish is sweet and refreshing, and it was pretty good. I smell a bit of bitterness and a crisp aftertaste.

We can also force the network to use some text at the beginning, we can get some nice reviews :

This one reminds me of a porter. Pours a moderate copper colour, with a malty straw color. Thick head that stays and left leaving no lacing. This one is pretty nice. The carbonation is in the mouth, creamy and pretty drinkable. The hops are the grainy and piney flavors even the hops right off One of my new large rum. I have got to sip a good brewery. It is by the 2007 barrelard for a consume. Just no hoppiness for the point. One of my favourite of all the weizen glass.Pours a bright straw color with beige gold colored head of good carbonation. Plenty of lace. Smell is caramel malt, and yeast.

I can go on for long with this… If you want to train your own RNN, just use Andrej’s Code on Github, he also made a simple version in numpy/python