Neural networks are an alternative to traditional programming.

Instead of writing an algorithm by hand, training data is given to the software - inputs and the expected output: ([0, 821, 1643, 2461, 3278, 4092, 4901,...],"art")

Neural network diagram

The neural network itself is a series of layers, each one consisting of one or more neurons. Each neuron can have many inputs, and a single output that can be sent along to many other neurons.

What is important is the way the numbers move around - as a number moves from one neuron to another, it is altered by the weight of that neuron.

The neural network software - in this case, the Keras library running on either the Theano or TensorFlow backend - takes the inputs and runs them through a neural network with randomly-generated weights.

Then the software changes all of the weights a bit and tries again. If it is closer to the right answer, it will keep changing the weights in that direction; if it got worse, it will go in a different direction. This is known as Stochastic Gradient Descent.