Making an artificial neural network

Started by
13 comments, last by NQ 18 years, 8 months ago
I am quite interested in the capabilities of an ANN. I would like to try coding one, for something fairly simple. I will do my own research, but I was wondering what would be an appropriate starting project. My only ideas that seem simple enough, and yet would give me some good experience, are making one for tic-tac-toe or checkers. Tic-tac-toe seems too simple, though, and it also seems that there would never be a reason to play against a computer that can "learn" - how many possible games are there, really? Checkers is more intriguing. I wouldn't mind playing against a computer that could learn my checkers style. However, it seems like it would be pretty dang complex. Remember, I have never made one, and don't know what the difficulty would be. Should I just make, say, a tic-tac-toe ANN, to test the waters, or do you have a better suggestion? My thanks.
my siteGenius is 1% inspiration and 99% perspiration
Advertisement
I'm kind of doing the same thing. But I don't think tic-tac-toe is a good start (don't think it's good for ANNs either).

A good place to start would be to research feed-forward ANNs. Try making it so the computer learns how to approximate the value of a mathematical function by feeding it training data (inputs and desired outputs).
What do you mean? Like teach it to approximate the value of A, if

A = 2X

Where you change the value of X? I don't want to knock the idea, especially in case I'm not understanding you correctly. However, it doesn't seem like the idea of an ANN is especially suited for that. Can you elaborate? Thanks.
my siteGenius is 1% inspiration and 99% perspiration
Hey I'm making one too! YAY CONNECTIONISM!

I don't think there's anything wrong with starting out *too* simple. The learning algorithms can be pretty hairy, and it would be pretty easy to make a small mistake that causes your network to never actually converge on a solution. So before you start tackling those complicated problems, try something really simple to make sure it works. And by "really simple", I'm talking a network that can learn to output 1 on input = 1 and 0 on input = 0. Then a good next step is have it solve XOR. Then go from there =)
Quote:Original post by silverphyre673
What do you mean? Like teach it to approximate the value of A, if

A = 2X

Where you change the value of X? I don't want to knock the idea, especially in case I'm not understanding you correctly. However, it doesn't seem like the idea of an ANN is especially suited for that. Can you elaborate? Thanks.

This is EXACTLY what ANNs are suited for (at least the feed-forward variety). An ANN is just a function approximater. When you train a network, you are simply trying to make it expose the function behind the data.
Turring Machines are better than C++ any day ^_~
I would just test it out on standard data sets like those from here http://www.ics.uci.edu/~mlearn/MLSummary.html That way you can compare your results with published results and verify your code works. For example on the original wisconsin breast cancer database I have gotten 96 percent test accuracy with my neural network code (I split the data into 33 percent test, 66 percent training and chose parameters with cross validation on the training set). This is consistent with published results of 94-98 percent accuracy on the problem.
Quote:Original post by Anonymous Poster
I would just test it out on standard data sets like those from here http://www.ics.uci.edu/~mlearn/MLSummary.html That way you can compare your results with published results and verify your code works. For example on the original wisconsin breast cancer database I have gotten 96 percent test accuracy with my neural network code (I split the data into 33 percent test, 66 percent training and chose parameters with cross validation on the training set). This is consistent with published results of 94-98 percent accuracy on the problem.


That site looked good, except that for all the FTP access links, there "is no such file or directory". Any ideas?

Anyways, I guess I will just make something super simple. Thanks, but keep the ideas coming. I like it when people reply to my topics :P

[EDIT]

Also, if I were to make an ANN that just outputs the sum of two numbers, what exactly would I be training? I mean, if the only operator it can use is addition, and it always takes two numbers, then what exactly would be changing each time? Whether it adds part of a number?

Or would this make sense: The computer gets two integer inputs. It can only add, but the weight that you are training is the fraction of the integers that it outputs. So if I entered 8 and 6, and desired the output 7, then it would start adding fractions of the two numbers, converging on 0.5 of each number?

In this case, what exactly would each node be looking at? I read an article that showed how a computer could be "taught" to recognize pictures of numbers and letters by examining portions of a picture. Each node looked at a segment of the picture, and based on whether the segment was mostly filled or not, the node retured 1 or 0. The letter was selected based on input from all the nodes. For example, here is a grid:

ooooooooXoXoXooooooooo oXo ooooooooo oXo oooooooo


In this example, each node examines one grid location, so you have 9 nodes. Nodes 1, 2, 3, 5, and 8 return true, and the rest false. So you get this return:

111010010

You say that the desired output of the picture (which evaluates to 111010010) is the letter T. At first, the program chooses other letters, but eventually recognizes the picture as a T. Now say you repeated with the letter I:


ooooooooXoXoXoooooooooXoXoXoooooooooXo o oooooooo


At first, the program thinks it is the letter T, probably - it is pretty similar. Eventually, it learns that this is P. Now say you gave it this input:


ooooooooXoXoXooooooooo oXo oooooooooXoXo oooooooo


Now what should the program think? It isn't an already learned letter, but let's compare the "output" of this picture as opposed to the other two:

T
111010010
P
111111100
New picture
111010110

There is one difference (at offset 6, from 0), out of 9 possible, from T. There are 3 differences from the letter P. Since it is closer to T than P, it outputs that this is the letter T. Using this method, you could train it to learn all letters and numbers.


The point is that this seems like a more "useful" use for an ANN, and one that makes more sense in my mind for how to implement. What do you think?
my siteGenius is 1% inspiration and 99% perspiration
As a little project, I use a neural network to control a virtual 2 wheeled robot, with distance and color sensors : 12 inputs and 2 outputs (the wheels motors). The task for the robot was to find a black area. When it was in this area, a light was activated. Then it must go on a white area.

The neural network was only 12 neurons, full connected. It was trained by genetic algorithms, around 4 hours to have a result. It was quite fun to see the robot...

Another cool stuff is to train a group of this kind of robots (two wheels and sensors) for a collective task, like pushing stuffs in the middle of a room.
Well, I went simple and made a very simple ANN that just does AND and OR. It works. It took me five minutes :) And I was reading for part of that time.

Anyways, I am looking into making XOR, but I'm confused as to exactly how it is supposed to work. If you have two inputs, x and y, XOR is true if (x) AND NOT (y) OR if (y) AND NOT (x). I fail to understand why

a) You need two "layers". If you are inputting 1 and 0 only for the inputs, and you have only two inputs (I don't see how you could have more for a XOR, or at least how it acts if there are more), then couldn't you just make the threshold equal to 1, and if it is not 1 then return false? Or is part of the definition of the "threshold" that is is a threshold, a bar you have to get over, not hit exactly? :)

b) How exactly would the multiple layers work? Does it mean an increase in the number of inputs, or the number of outputs, or what? I'm confused :(

Thanks for your help.

//EDIT

I actually ended up successfully making AND, OR, and XOR neural networks. They aren't trainable, but they aren't hardcoded, and each are made up of identical parts.

Now I need a new, slightly more complex project. Hmmm...

[Edited by - silverphyre673 on August 13, 2005 3:11:22 AM]
my siteGenius is 1% inspiration and 99% perspiration
Something from the distant past [VRANN]. This was a college project. Since there isn't enough time to create an ANN for speach recognition, we scaled the project back. In the end we ended up doing voice identification instead. Each person on the team would say the same word, and the program could identity which person said it.

Fun project to do with an ANN. I took screenshots of the steps we used. FFT is a fourier transform. It take a wave microphone same (amplitude over time) and converts it to (amplitude over frequency).
*News tagenigma.com is my new domain.

This topic is closed to new replies.

Advertisement