First, let's define a neural network : It's a group of neurons connected to one another that takes one or more input and returns one or more outputs.
You can model a neural network as some kind of function.
The neural network that we will study here are made out of layers. Each layer contains neurons. The neurons inside a layer are not connected.
Each layer is a smaller network that is processing the information in it's own way. The first layer applies a first simple process, the second layer
makes a more complex analysis and so on.
Usually, neural network are used to accomplish complex task that are not suited for a computer : Image recognition, Voice analysis ...
The strengh of neural network is their ability to "evolve" : You can modify a neural network so that it give slightly different answer. Then,
you can test if your neural network is more efficient than previously and repeat. That way, the neural network will be improving itself over time.
Given enough time to train and a good "teacher" (a function that evaluates the performances of the network), this kind of program can do anything.
Let's dive in and see precisely how they work.
We initialize the network (With 1 and 3 for example):
(1*1*0.25) + (3*1*0.75) = 0.25 + 2.25 = 2.5General formula to compute the value of the first neuron of a layer based on the entering connections :
StartValue + (n1_value * n1_weight * n1_connection_1) + (n2_value * n2_weight * n2_connection_1) + (n3_value * n3_weight * n3_connection_1) + ...The code used to generate the network :
Networks can be a lot more complex than what we've just seen : This network take 5 inputs and gives back 4 answers.
Here, the weight of each neuron and the weights of his connections are random to make things even more interesting.
The code used to generate the network :
We will now draw the results of a neural network given 2 outputs to show how powerfull a neuron is.
We can see that just by changing 2 parameters, the neural network can process quite complex patterns.
Here are some remarquable cases :
Let's try to train our network with a simple task : collecting apples in a field (green dots)
Ok, let's define the problem more precisely :
Above, a visualization of what the robot sees and the 2d world. Below, the brain of the robot
Results :
Work in progress. Just a fancy gradient generator for now.
Made by vanyle (2017) in javascript, Feel free to reuse the code.
The code to create networks is below.