Political speeches are among the most powerful tools leaders use to influence entire populations. Throughout history, political speeches have been used to start wars, end empires, fuel movements & inspire the masses.Political speeches apply many of the tricks found in the field of Social engineering: Congruent communication, intentional body language, Neuro-linguistic programming, HumanBuffer Overflows and more. Read more about The art of human hacking here.In recent years, Barack Obama has emerged as one of the most memorable and effective political speakers on the world stage. Messages like Hope and Yes we can have clearly left a mark on our collective consciousness. Since 2007, Obama’s highly skilled speech writers have written over 4,3megabytes or 730895 words of text, not counting interviews and debates. All of Obama’s speeches are conveniently readable here.With powerful artificial Intelligence / machine learning libraries becoming readily available as open-source, it seems obvious to apply them to speech writing. A particularly interesting class of algorithms are Recurrent Neural Networks (RNN).Recently Andrej Karpathy, a CS PhD student at Stanford has released char-rnn, a Multi-layer Recurrent Neural Networks for character-level language models. The library takes an arbitrary text file as input and learns to predict the next character in the sequence. As the results are pretty amazing, many interesting experiments have sprung up, ranging from composing music, rapping, writing cooking recipes and even re-writing the bible:Step 1 is to feed the model data, the more the better. For this i wrote a web-crawler in python that gathers all publicly available Obama Speeches, parses out the text and removes any interviews/debates.Step 2 is to train the model on the collected text. Training an RNN takes a bit of fiddling, as i painfully found out while training a model on 500mb of classical music midi files (mozart-rnn is wild!). Luckily the standard settings that Andrej suggested were a good starting point for the Obama-RNN.Step 3 is to test the model which automatically generates an unlimited amount of new speeches in the vein of Obama ́s previous speeches. The model can be seeded with a text from which it will start the sequence (e.g. war on terror) and a temperature which makes the output more conservative or diverse, at cost of more mistakes.Here is a selection of some of my favorite speeches the Obama-RNN generated so far. Keep in mind this is a just a quick hack project. With more time & effort the results can be improved.One of the most hilarious patterns to emerge, is that the Obama-RNN really loves to politely say: Good afternoon. Good day. God bless you. Good bless the United States of America. Thank you.I did a test combining Obamas speeches with other famous speeches from the 20st century (including everything from Mother Theresa, Malcom X to Mussolini and Hitler). This gives us an rather insane amalgam of human thought, seen through the “eyes” of a machine. A story for an other day.On this note: God bless you. Good bless the United States of America. Thank you.You can run your own Obama-RNN by following these instructions:Get in touch here: https://twitter.com/samim | http://samim.io/From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.Designer & Code Magician. Working at the intersection of HCI, Machine Learning & Creativity. Building tools for Enlightenment. Narrative Engineering.