browse OpenProcessing

Matrix-yo
Artificial Neural Network
Square Maker
browse all>

browse the portfolio of Alasdair Turner

de Casteljau Bezier curve
NURBS surface
Bezier curve
Emergent Voronoi diagram
see more>
Artificial Neural Network

Artificial Neural Network

uploaded by
Alasdair Turner
Instructions: left-click to test, and right-click (or ctrl+click on a Mac) to train.

This is a standard feedforward network with a single hidden layer.

The demo identifies handwritten numbers. The data are originally from the National Institute of Standards and Technology (USA). I used the MNIST processed versions available from Yann LeCun and
Corinna Cortes
.

After about 10 or so training clicks, the net should do a fairly good job of recognising numbers.
Embed Code
Fave'd by 14 users
Sketch added to your favorites in your portfolio.
You must login/register to add this sketch to your favorites.

comments

source code

Comments

Sinan
04 Jun 2009, 16:42
I didn't quite understand what the difference between training and testing. Isn't it usually you train by saying 'yes' or 'no' for a particular guess?
Alasdair Turner
04 Jun 2009, 17:14
I've split the data into two: 8000 "training" samples and 2000 "testing" samples. You are quite right that when the net is given a "training" sample, it makes a guess, it is told the answer, and it adjusts its weights in order to learn the result. Each time you right-click, this process is repeated 1000 times, picking the samples at random from the "training" data and adjusting the output in response.

So far, I assume, so good! Now for the part that seems slightly odd at first:

Each time you left-click, the neural net is given a sample from the "testing" set. It is not told the answer, and does not learn from this test. The point of doing it this way is to give the neural network a sample it hasn't seen before -- when you test it in this way, you're making sure it isn't just giving you answers it's learnt by rote, but that it has genuinely learnt something about the way hand-written numbers look.

I know it's somewhat confusing to begin with, but it's a standard method from the machine learning community to test how well your neural net has learned something.

I hope this helps!
Alasdair Turner
05 Jun 2009, 01:29
That should say "repeated 500 times" -- oh for a comments editor, Sinan ;-)
bejoscha
09 Jul 2010, 10:33
Hmm, could you explain a little further what is going on, and what one can "see" in this sketch? I am not sure I fully grapped it.
Alasdair Turner
09 Jul 2010, 11:28
I can try.

Firstly in technical language, and then as a more intuitive description. You're looking at a feed-forward multilayer perceptron, with one input layer (at the bottom), one hidden layer (semi-transparent) and one output layer (at the top). Each layer has a number of perceptrons (artificial 'neurons'): there are 196 in the input layer, 49 in the hidden layer and 10 in the output layer, so in the literature, it would be called '196-49-10' network.

All the perceptrons in the input layer are connected to all the perceptrons in the hidden layer (a total of 196 x 49 = 9604 connections), and all the perceptrons in the hidden layer are connected to the output layer (49 x 10 = 490 connections). These connections are not shown because there are simply too many of them to make any sense. All you see is the response of each perceptron in the hidden and output layers to the summation of its inputs.

In metaphoric language: the 'input layer' might be thought of as a 'retina' which is presented with a number. These 'neurons' either excite or inhibit the response of the brain through their connections to the 'hidden layer'. The 'hidden layer' might be thought of as an indication of the brain activity in response to the retinal image. Similarly the 'output layer' might be thought of the result of the brain activity leading to a signal to say 'one', 'two', 'three' and so on up to 'nine' and finally 'zero'.

If there is just one black and nine white neurons displayed in the output layer, that is a signal to say that number - e.g., if only the fourth neuron along is black, that means 'say four'. If more than one is dark grey, that is a sign the network is unsure. For example it might 'think' it is seeing either a 'four' or a 'nine', and mark both of those as almost black.

The two printed numbers to the right reflect the actual known input at the bottom (e.g., this image presented to the retina is intended to be a '4'), and the network's best guess at the top (e.g., I'm not sure, it could be a '4' or a '9', but if I had to choose, I would say it's a '9').

I hope this helps!
You need to login/register to comment.