This is my first attempt at creating a learning machine, I will be making more in the future. In this version, I decided not to use a library as I wanted to know how it worked. This is my basic understanding.
If you look, you should find a neurons object. This contains lots of other neuron objects, which in turn have connection objects. The way this works is each neuron has a layer, which is where it comes in calculations. There is an input layer and an output layer. When you trigger the get function on the neurons object, it will find out the neurons in the output layer and get them to ask their parent neurons what their response is. This is where connections come in. They multiply the parents output by their own, decreasing or increasing the chances of triggering the initial node.
The explanation above is a little complicated, and there are lots of videos on this. However, in this particular example it is trying to learn to play flappy bird. The input neurons contain data about the pipes and a bias neuron (which is always on) and the outputs are really simple – jump.
For each generation of 500 birds, it will select the neuron network of the best bird and store it. Then, in the next generation, it will compare it’s best bird to the current one and store it in best-best bird.
Unfortunately, running this creates high lag from the second generation onwards and I have yet to fix this. However, I am open to suggestions.
I want to be like you when I grow up!