Neural Networks in Javascript using p5.js
- Provide the Perceptrons inputs for which the answer is known
- Ask Perceptrons to guess the answer
- Calculate the error
- Adjust the weights according to the error so as to steer the guessed answer towards the actual answer
- Go to Step 1 and repeat
Visualizes 500 points and uses the perceptrons to guess correctly if the point lies above or below the dividing line. The dividing line is represented by equation y = mx + c. So, this code works for any generic line provided by this equation.
We try to solve the XOR problem which cannot be solved by a linear seperator like a Simple Perceptron implemented earlier. A Multilayer Perceptron is implemented using a feedforward Neural Network. This feedforward NN uses backpropagation for adjusting its weights and bias. The process of backpropagation basically is adjusting the values of weights and bias so as to obtain the desired outputs. The Neural Network has 2 layers: a hidden layer and an output layer. It also exercises a bias for each of the layer to obtain proper output. Refer the notes in order to gain insights into the structure of the Neural Network.
Neural Network Structure and Outline
Backpropagation for adjusting weights and bias
Mapping backpropagation algorithm to higher dimensions
- The Coding Train website: http://thecodingtrain.com/
- 3Blue1Brown Neural Network playlist: https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi
- Make Your Own Neural Network by Tariq Rashid