-
[VB6] Neural Network
Since a neural network is missing in the codebank
here is my version:
It's very simple.
It initializes with "CREATE"
Code:
NN.CREATE Array (2, 2, 1), 0.25, 4
-Where Array indicates the NN topology
Array (N of Inputs, Hidden layer neurons, ..., Hidden layer neurons, N of outputs)
-The second term is the Learning Rate.
-The third is the initial range of connections. (this value, together with the Learning Rate is very important and can drastically change the learning outcomes)
To get the output just call RUN with an array of inputs as arguments,
Return the Outputs Array
For learning (which is supervided) just call TRAIN.
The arguments are an array of Inputs and an array of expected Outputs
The learning process is done by backpropagation, the code is taken (and modified) by an article by Paras Chopra.
Neurons Index "Zero" [0] of each Layer is used for Bias. It is always 1 (The Biases are the weights of connections from 0-indexs neurons to next layer neurons) [Still not sure this way is correct tough]
Inputs and outputs range is from -1 to 1
the Activation function used is TANH.
Probably I'll put it on Github.
Enjoy
And, as always, anyone has ideas to improve it, is welcome
-
1 Attachment(s)
Re: [VB6] Neural Network
Hi
I added a Genetic Algorithm.
The NN now can be trained by Backpropagation or with GA (NN+GA = Neuroevolution)
Neuroevolution is very useful when can't use Backpropagation
Here is an example of what one can do with Neuroevolution
https://www.youtube.com/watch?v=g11LN0UIynY
If you want to have fun with Evolving Creatures you can download here the Portable Zipped App.
-
Re: [VB6] Neural Network
I don’t know how I ever missed this, but it’s incredible.
-
Re: [VB6] Neural Network
For those interested in the topic I share these goodies.
An interesting interview with a co-author of NEAT's "Neuroevolution of augmenting topologies"
https://www.youtube.com/watch?v=CY_LEa9xQtg
- Here is a video describing NEAT. In the description of it there is a link to the related PDF.
- A more advanced version of NEAT on Github: neataptic and The neuro-evolution algorithm used.