Posts

Showing posts with the label Feed Forward

Neural Network (Part 6) : Back Propagation, a worked example

Image
A worked example of a Back-propagation training cycle. In this example we will create a 2 layer network (as seen above), to accept 2 readings, and produce 2 outputs. The readings are (0,1) and the expectedOutputs in this example are (1,0). Step 1: Create the network NeuralNetwork NN = new NeuralNetwork();    NN.addLayer(2,2); NN.addLayer(2,2); float[] readings = {0,1}; float[] expectedOutputs = {1,0}; NN.trainNetwork(readings,expectedOutputs); This neural network will have randomised weights and biases when created. Let us assume that the network generates the following random variables: LAYER1.Neuron1 Layer1.Neuron1.Connection1.weight = cW111 = 0.3 Layer1.Neuron1.Connection2.weight = cW112 = 0.8 Layer1.Neuron1.Bias = bW11 = 0.5 LAYER1.Neuron2 Layer1.Neuron2.Connection1.weight = cW121 =  0.1 Layer1.Neuron2.Connection2.weight = cW122 =  0.1 Layer1.Neuron2.Bias = bW12 = 0.2 LAYER2.Neuron1 Layer2.Neuron1.Connection1.weight = cW211 = ...

Neural Network (Part 1) - The Connection

Image
Introduction In this tutorial, I am going to walk you through my interpretation of a neural network. I will use terminology that makes sense to me, hoping that Neural Network enthusiasts don't get offended by my novice approach. This is what a feed-forward Neural network normally looks like:  The input layer receives input from the outside world, and passes this value to the hidden layer. The value that reaches the hidden layer depends on the connection between the layers. Each connection has a weight. This weight multiplier can either increase or decrease the value coming from the input layer. Like water coming out of a tap, you can make it come out faster or slower (or not at all). This weight can even be negative, which would mean that the water is being sucked up, rather than pouring out. The hidden layer then processes the values, and pass them onto the output layer. The connections between the hidden layer and the output layer also have weights. The values in the output layer...

Poor Man's Colour Detector (Part 1) - The concept

Well, I have finally done it. Not sure if I should post the tutorial, because it is not very basic. But then again, a novice like me managed to do it, so why not !! We will need to pull together a number of previous blogs, but rather than jumping back and forth, I think I will just walk you through from beginning to end, and hope that I don't lose you along the way.  The concept In my earlier blog posts, I managed to get LEDs to detect light. And through a bit of trial an error, plus a bit of internet research, I found out that an LED will detect light of the same wavelength that it emits. Therefore a red LED will detect RED light, and a yellow LED will detect yellow light etc etc. I decided to test this theory by placing different coloured MEGA-BLOKs over the LEDs to see if there was any difference ? And from my simplistic experiments, I could see that the RED LED responded much better to a RED Mega-blok than any other colour, and a YELLOW LED responded mu...