Neural Networks!
1. Introduction on Neural Networks
2. Applications of Neural Networks
3. How the Scripts Work
4. Scripts Download
1. Introduction on Neural Networks
Those who are new to Neural Networks are probably asking: "What are these so called "Neural Networks" people are talking about these days? And what are so darn special about them?"
Well the first thing that you need to know about Neural Networks -- or NNs for short-- is that it's a very simple concept to grasp. What NNs are based off of are the neurons in a brain (if you don't know what neurons are here's a good link).
The basic make-up of a neuron is essentially 4 main parts. You have the input, which takes in all the information. You have the weight, which usually multiplies the input by a specific number. The hidden level, adds up specific multiplied inputs with the weights. And lastly you have the output; the output takes in all the hidden layers and puts them all together. If the total is past a certain point, it shoots a signal with a specific number to something else that takes in that output.
That is what an neural network is made up of. Sometimes only a dozen of these neurons, but there could be more. So if you're still iffy on neural networks I suggest reading a very good and easy to understand tutorial on them. Found here.
2. Applications of Neural Networks
If you read the previously stated tutorial, you probably have a good grasp on the uses of NNs. If you didn't read the tutorial then here are some of the basic applications of neural networks.
- Image Recognition
- Pattern Recognition
- Object Avoidance
- Following an Object
- Even a combination of all them
These are just the basic applications of neural networks, but in fact they can do so much more! You can even make a learning ai if you're good enough...
3. How the Scripts Work
The scripts work in a very simple yet complex way. The way they work is through a lot of interconnected ds_grids. There are four sets of grids, input, hidden, output, and weight. The input takes the input variables, and sends it to all of the connected weights. Then, then weights multiply it by their weight and send that input to the specified hidden node. The hidden node then adds up all of the weights and finally sends it to the output node to be stored. Lastly, you can get the outputs and use them to your advantage.
First before you do anything! Please add these constants
Variable Value
input 1
hidden 2
output 3
weight 4
NIA -2*3.141592653
ON 2*3.141592653
OFF -2*3.141592653
Now onto how to use the scripts. First you have to create the actual Neural Net, just use the script create_NN(). That returns an index of that NN so that you can use it for all the other scripts.
NOTE: The Neural Net Index or NNI is what the returned value from the create_NN() script. It is used for ALL the rest of the scripts. The reason why is because you have to specify which node that you are using is in which neural network, don't forget that!
Next, you have to create your inputs. Use the script create_input(NNI, Variable Name) to create an input. The variable name is the variable that goes into the input. You have to actually create that variable somewhere else, the scripts will automatically get the values later on.
After you created all your inputs you have to create the hidden nodes next. Use the script: create_hidden(NNI) to create a single hidden node.
After you're done making your hidden nodes, you have to create the output layer next with the script: create_output(NNI).
Now you're done creating the basic infrastructure of your neural net! What you have to now is to link everything together. First you have to link the inputs with the hidden layer. You don't have to link inputs to weights because it's automatically done when connecting an input to a hidden layer. To do this use the script link_nodes(NNI, type1, type2, node id, node id). When using the script you have to specify what the kind of nodes you are linking together, that would be the arguments type1 and type2. The node ids are the indexes that are returned from creating the nodes.
An example use of it would be: link_nodes(MovementNN, input, hidden, HandInput, HandHiddenLayer).
When you are done connecting everything you have to set the weights (they default to 0). Using the set_weight(NNI, weight id, value) you can set the weight with the specified value.
Now you're done creating and setting everything! Onto the step event.
The first thing that you have to do in the step event is to refresh all the variables you want to use in your NN. After that just use the script refresh_variables(NNI) to actually set the neural net in motion. After that you can use the script get_output(NNI, output id) to get your final output of the spcified Neural Net of the specified output.
Now you're done! You can use the output for anything you like! Wasn't that easy? <--Sarcasm?
Last note: (if you didn't catch this the first time) All the creation scripts for the NN, input, hidden, output, and weights, return the index of that specific node. And through a funky programming glitch, all the indexes start at 0 EXCEPT weights, they start at 1.
4. Scripts Download
Now if you're PUMPED about making a neural net, here are some download links
Example
File Front
Box.net
Scripts
File Front
Box.net
Memory Scripts
File Front
Box.net
EDIT: The scripts and examples are now all commented
Comments, questions, suggestions, and bug sightings are all welcome!
Right, these are free to use though I just ask you put my name in somewhere. It's not a necessity, it's just that I don't want people taking credit for my work. Thanks in advance! (By the way my name is Sam Rohde)
Hope this helps! Good Luck!
Edited by coolkat677, 19 August 2009 - 10:39 PM.











