PyGrunn: deep learning with tensorflow (“Trump tweet generator”) - Ede Meijer

Tags: pygrunn, python

(One of my summaries of a talk at the 2017 PyGrunn conference).

He originally used a java solution for ‘machine learning’, but that didn’t work very comfortably. He then switch to tensorflow, written in python.

Machine learning is learning from data without being explicitly programmed. You feed the computer lots of data and it learns from that. Some examples of the techniques used: linear regression, logistic regression, decision trees, artifical neural networks and much more.

Artificial neural networks are what tensorflow is about. A normal neural network has “input layer”, a “hidden layer” and “an output layer”. The nodes in the three layers are connected. The neural net tries to learn the “weights” of the connections.

Deep learning means you have neural networks with multiple hidden layers. Often it deals with features at different levels of abstractions. Images that have to be recognized can be cut in to several pieces of different sizes and fed to the net as those parts, but also as the full image. Training a model often works wit minimizing error by using the “gradual descent” method.

Tensor flow? What are tensors? Well, a 0D tensor is a scalar, 1D a vector, 2D a matrix, etc.

Then he started showing code examples. The ultimate test was trying to learn the network to talk like Trump. So it got fed a huge number of Trump twitter messages :-) It worked by defining a number of “layers” in order to predict the next character in a tweet. Very low-level, thus.

In the end the generated tweets started to look like Trump tweets. The code is here: https://github.com/EdeMeijer/trumpet

https://abload.de/img/screenshot2017-05-08ai9z30.png

Photo explanation: just a nice unrelated picture from the my work-in-progress german model railway

Dutch note: python+django programmeren in hartje Utrecht bij de oude gracht? Watersector, dus veel data en geo. Leuk! Nelen&Schuurmans is op zoek. Stuur mij maar een mailtje, want de vacaturetekst staat nog niet online :-)

 
vanrees.org logo

Reinout van Rees

My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):