Obama-RNN — Machine generated political speeches.

samim
8 min readJun 5, 2015

--

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 Speech Definition: Expressions which comment on government action rather than the private conduct of an individual.

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.

Recurrent Neural Networks

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).

RNN is a class of artificial neural network where connections between units form a directed cycle. This creates an internal state of the network which allows it to exhibit dynamic temporal behaviour. Unlike feedforward neural networks, RNNs can use their internal memory to process arbitrary sequences of inputs.

Sign up for the Newsletter for more experiments like this!

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:

Learning Obama

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.

The speeches

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.

SEED: Jobs

Good afternoon. God bless you.

The United States will step up to the cost of a new challenges of the American people that will share the fact that we created the problem. They were attacked and so that they have to say that all the task of the final days of war that I will not be able to get this done. The promise of the men and women who were still going to take out the fact that the American people have fought to make sure that they have to be able to protect our part. It was a chance to stand together to completely look for the commitment to borrow from the American people. And the fact is the men and women in uniform and the millions of our country with the law system that we should be a strong stretcks of the forces that we can afford to increase our spirit of the American people and the leadership of our country who are on the Internet of American lives.

Thank you very much. God bless you, and God bless the United States of America.

SEED: War on terror

Good everybody. Thank you very much. God bless the United States of America, and has already began with the world’s gathering their health insurance. It’s about hard-earned for our efforts that are not continued.

We are all the assumptionion to the streets of the Americas that we are still for everybody and destruction. We are doing a lot of this. I know that someone would be prefered to their children to take a million insurance company. We’re watching their people and continued to find ourselves with Republicans — to give up on these challenges and despite the challenges of our country. In the last two years, we must recognise that our borders have access from the world. We’re continuing that this day of things that the United States will clean up it´s allies and prosperity to stand up enough to be a sanctions that we made their faith, and for the country of the Internet to Osama bin Laden.

For our businesses are implemented in the region that the United States and Afghanistan, we will make a better law — the concept of the world that we don’t have access to the politics of our own law fair. And the parties and promise we can take in the country and a lot of concern to the foundation for the first time and secret of the Depoter of Energys and Staff and China.

We are a strong private Americans to death our employees that will not be focused on their example for the amount of coverage to fover the past week. That’s what our troops can look forward to many years old to take a family and support of the people that asks are all that the world as a lot of change. And while the courage of the commitment to the Sunni partnership was a partnership for the United States of America.

Thank you. God bless you. Good morning, everybody. And May God loss man. Thank you very much. Thank you very much, everybody.

SEED: Democracy

Good morning. One of the borders will be able to continue to be here today. We have to say that the partnership was a partnership with the American people and the street continually progress that is a process and distant lasting peace and support that they were supporting the work of concern in the world. They were in the streets and communities that could have to provide steps to the people of the United States and Afghanistan. In the streets — the final decade of the country that will include the people of the United States of America. Now, humanitarian crisis has already rightly achieved the first American future in the same financial crisis that they can find reason to invest in the world.

Thank you very much. God bless you. God bless you. Thank you.

SEED: Yes we can

Good morning. And as we mark the fact that they can stand with their companies that are consistent to the state of Pakistan and the United States of America.

With the financial system we can do that. And the people of the United States will not be able to continue to support the people of the greatest problem of the American people to stay in the White House. And that’s why I’ve got to recognize the private sector that there is no doubt that we’ve got to continue to shape the painful realisation that we are the United States of America. And these are the people of all Americans to be recognising the continent of the reason that they don’t have to stay on the law.

It was the first time in Muslim Americans to see your own lives. And the United States will be better profitable and security and prosperity to the American people — she was a candidate for the same recession that they have to make sure that they take a state in the United States of America.

Thank you very much. God bless you. God bless you. God bless you. God bless you.

SEED: China

Thank you so much. Please, everybody, be seated. Thank you very much. You’re very kind. Thank you.

I´m pleased in regional activities to speak to your own leadership. I have a preexisting conditions. It is the same thing that will end the right to live on a high-traction of our economy. They faced that hard work that they can do is a source of collapse. This is the reason that their country can explain construction of their own country to advance the crisis with possibility for opportunity and our cooperation and governments that are doing. That’s the fact that we will not be the strength of the American people. And as they won’t support the vast of the consequences of your children and the last year. And that’s why I want to thank Macaria. America can now distract the need to pass the State of China and have had enough to pay their dreams, the next generation of Americans that they did the security of our promise. And as we cannot realize that we can take them.

And if they can can’t ensure our prospects to continue to take a status quo of the international community, we will start investing in a lot of combat brigades. And that’s why a good jobs and people won’t always continue to stand with the nation that allows us to the massive steps to draw strength for the next generation of Americans to the taxpayers. That’s what the future is really man, but so we’re just make sure that there are that all the pressure of the spirit that they lost for all the men and women who settled that our people were seeing new opportunity. And we have an interest in the world.

Now we welcome the campaign as a fundamental training to destroy the principles of the bottom line, and they were seeing their own customers. And that’s why we will not be able to get a claim of their own jobs. It will be a state of the United States of America. The President will help the party to work across our times, and here in the United States of uniform. But their relationship with the United States of America will include faith.

Thank you. God bless you. And May God loss man. Thank you very much. Thank you very much, everybody. Thank you. God bless the United States of America. God bless you. Here’s President.

Final thoughts

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.

Code

You can run your own Obama-RNN by following these instructions:

Get in touch here: https://twitter.com/samim | http://samim.io/

--

--

samim

Designer & Code Magician. Working at the intersection of HCI, Machine Learning & Creativity. Building tools for Enlightenment. Narrative Engineering.