[ home | resume | contact | science | art | personal | email ]

Jim Davies: Research: Neural Networks

One summer at Los Alamos National Labs I started trying to make a neural network. What makes this net interesting is that:

Later I found out that this is just like a Hopfield net.

For an introduction to more traditional neural networks, see these lecture notes from a class on the subject.

To install on UNIX:

  1. Download gneuralnet.tar.gz file.
  2. put in in a new directory
  3. type gtar -zxvf gneuralnet.tar.Z
  4. type cat INSTALL
  5. follow the instructions on the screen. If you are installing it for personal use, and not for the system, instead of typing:
    ./configure
    you will want to type something like:
    ./configure --prefix=`pwd`

How the net works

I'll describe to you how it's implemented by showing you a simplified example of the kind of net I am building. In the following array, A, B, C and D are the nodes, at locations (1,1), (2,2), (3,3), and (4,4).

  1 2 3 4

1  A - - -
2  - B - -
3  - - C -
4  - - - D
These nodes have values. If the value is greater than 1 then the node is considered fired. The dashes represent connection weights. For example:

 A .1 .2 .1
.6  B .4 .9
.0 .2  C .3
.1 .2 .7  D
Say node C fires. Examine the column C is in. It has a .2 connection weight in the A row. This is C's connection to A. So if C fires, then .2, or some function of .2, will be added to A.

Likewise, .4 will be added to B and .7 will be added to D. Note that though C's connection to A is .2, A`s connection to C is .0.

So when the net is working, it goes through the nodes and determines which have fired. After this list is created, it goes to all the fired node's colums and adds the appropriate weight to every other node. Some that were below one before are now over one, and will fire.

As I have described it, all the nodes would accumulate weight and eventually fire. To avoid this I put in decay. The decay I am using right now is .10. Then, after a node fires, it automatically decays an additional .80.

So the algorithm goes like this:

So we end up with an output that consists of the node states at each time step. The X is a fire and the . is not:


.X.......X..XXX..XX.X..X.X.XX.X.X.XXXXX..X..X.XXXX........XX.X.XXX..X....XXXXX.XX..X..X.XX..XX....X.
.X.........XXX...X..X..X....X....X...XXX.X...XXXXXX.XX...XXXXX......X..XXXXX.X...X.XXXX.XXX.X.XX.XXX
XX.XXXX..X..X.XXXXX.XXX.X..X.XXXX...X.X.X..XX......X....X.....XXXX.X.XX....X...XX.X....X...XXX..X...
..X.X..XX.XX.X.....X...X.XX.XX....XX.X.X.XX...XXXXX...XX..XXXX....X.X..XXXX.XXX..X.XXXX.XXX......XXX
XX.X.XX..X..X.XXXXX.XXX.X..X..XXXX..X.X.X..XXX.....XXX..XX....XXX..........X...XX.X....X...X..XX....
..X.X..XX.XX.X.........X.X........XX.X.X..X...X.XXX...XX...XXX...X.X.XXXXXX.XXX..X..XXX.XXX.XX..XXX.
XX.X.XX..X.....X..XX.X..X.XXXXXX.X....X..X.XX..X....XX...XX...XXX.X.X..........XX.XX..........XX...X
..X.X...X...X.X.XX..X.X.........X.XXXX.XX.X..X....XX...XX..XX....X...X..X.XX..X..X.....XX..XXX..XX..
.......X..XX.X.........X.XX.XXX...............XXXX....X...X..X....XX..XX.X..XX..X..XXXX..XX.......XX
XX.X.....X..X..X..XX.X.....X...X.X....X..X.X......X..X...X.....XX...X.....X....X..X...........XX.X..
..X.XXX.......X.XX..X.X.X.......X..X.X.XX...X.......X...X..X..X......X.....X..X........XX..XXX......
........X................X........X.X.....X..X.....X...X....XX...X.....XX...X....X........X.....X.X.
...........X.X..............XX...................X..............................X...X..............X
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

Output

There is no distinction between the input, hidden, and output nodes. The nodes you input into are the same nodes you ever deal with. This is one distinguishing characteristic this approach has from many other neural nets (every one I've ever heard of). This poses the problem, though, of how to interpret and acertain the output. Following are some suggestions.

Training

The above output was created with random weights and a random initial firing input. Ideally, the input will be meaningful and the weights will be adjusted during training.

There are many ways to train a network. I will describe the way that I will do it. I am using the convergence output method as described above. The problem the net is trained to solve will be finding the majority. So the input is a string of ones and zeros, and the net wants to determine if there are more ones or zeros in the string. If it converges on not firing, then the net guessed there were more zeros, and if it converges on all firing, then it guessed that there were more ones.

So you generate a string, and determine through conventional means whether there is a majority of ones or zeros. Then you input this string into the nodes. For simplicity, the string is as long as the string of nodes. So you just put those ones and zeros as the values of the nodes.

Run the net through a set number of iterations, say 50. If it converged correctly, then the weights get reinforced if not than those nodes get punished.

Reinforcement works like this: For every node, reinforce according to how many times it was fired. Make every weight that is greater than zero greater, and every weight that is less than zero even less (There can be negative weights).

Punishmentworks the same way, except that instead of making the weights further from zero the weights are brough closer to zero.

What's the point?

The net should get better and better at determining which value is in the majority. After sufficient training, it might be absolutely reliable.

How boring.

I agree.

The GUI frontend

I made a GUI for it in STK. Here is a screenshot of it.
JimDavies ( jim@jimdavies.org )
Last modified: Wed May 14 09:51:24 EDT 2003