What are Recurrent Neural Networks?

Recurrent Neural Networks are a type of machine learning algorithm, which let you input some source material, create a model from it, and then predict new content.

So if you trained a neural network on all of Shakespeare’s plays or all of Jane Austen’s novels, you can generate new text that sounds like it could have been written by them, as the algorithm learns the vocabulary, grammar and any idiosyncrasies from the text you fed into it.

Creative uses of RNNs

People are using Recurrent Neural Networks for all sorts of interesting creative projects

Janelle Shane at AI Weirdness is using them to create things like :-

How to Generate (Almost) Anything are using them to create things like :-

The tools

So we knew that we wanted to try to use a RNN to generate the recipes.

First we tried installing Python, Keras and various AI tools directly, and using a pre-packaged Deep Learning virtual machine, all of which ran too slowly on our computers.

Finally we found a great tool called textgenrnn, and a place to run it: Google Colaboratory.

Textgenrnn

Textgenrnn is an open source tool to help you create text-generating neural networks, created by Max Woolf, a Data Scientist at Buzzfeed.

It's a Python module that sits on top of the deep learning frameworks Keras and Tensorflow, and it abstracts away most of the complexity.

Max has also created some very helpful blog posts and video guides which we followed.

Colaboratory

Colaboratory is a Google research tool for machine learning education and research.

You can run your code on runtimes with GPUs and TPUs, so it was about a million times more powerful than our workstations!

Best of all it's access it from Google Drive, fully collaborative, and it’s free to use.

Getting the source recipes

First we collected hundreds of cupcake recipes from places like the BBC recipe site.

You need to input *a lot* of content for the best results.

Training the model

Using textgenrnn we trained a model on the recipes, running it over and over until it seemed like it had learnt the structure.

Then it generated lots of new (& weird) recipes.

At first they were mostly unreadable, with nonsense text and gibberish words.

Some of them were legible, but made no sense - like suggesting a cake recipe that used 18 eggs!

The cakes!

We found the best ones, and chose five recipes to make - have a look at the pictures here.

We talked about the project at the Xmas I'll Be Back Event, and everyone got a chance to try a cake!

Got any questions?

Email us at hello@cupcaikes.com or fill in the form below