Posts

Showing posts with the label Programming

Neural Network (Part 5): The Back Propagation process

Back-propagation Back propagation is the process by which you move backwards through the neural network to adjust the weights and biases so as to reduce the total error of the network. The total error of the network is essentially the difference between the end results ( actual Outputs) and the  expected results. If you expected to get a result of 1, but instead got a 0:  you would go back through the network and tweak each of the weights (and bias) values so that your end result was a little bit closer to 1 than before. The process of back-propagation is such that larger errors and larger weights and biases that create those errors are penalised more than their smaller counterparts. Bigger weights have a bigger influence on the final outcome than smaller weights, and are therefore penalised more for incorrect answers. After many training cycles, the neural network reaches a stage of equilibrium (not quite, but close enough), whereby the tweakin...

Neural Network (Part 4): The Neural Network class

Image
The Neural Network Finally, we made it to the Neural Network class. This is the top level class that manages the communication between the layers. This class provides the necessary glue to hold all the layers together. It also controls the flow of information forwards and backwards from layer to layer. Lets have a look at a simple 2 layer neural network. The above neural network starts with 2 inputs in Layer1 and finishes with 2 outputs in Layer 2. This Neural Network structure is very modular in design. Layers can be added quite easily without affecting the functionality of the neural network code. The only layer that is treated a little bit differently from other layers in the neural network,  is the last layer.  However,  any/all preceding layers are treated exactly the same. And the differences in the last layer, only really come into effect in Neural Network training. When building my network, I just need to make sure that the number of outputs (o...

Neural Network (Part 3): The Layer

Image
The Layer The purpose of a layer is mainly to group and manage neurons that are functionally similar, and provide a means to effectively control the flow of information through the network (forwards and backwards). The forward pass is when you convert input values into output values, the backwards pass is only done during network training. In my neural network, the Layer is an essential building block of the neural network. They can work individually or as a team. Let us just focus on one layer for now This is what a layer with two neurons looks like in my neural network: As you can see from the picture above, I tend to treat each neuron as an individual. Both neurons have the same connEntry values ( cEn11 = cEn21 ) and ( cEn12 = cEn22 ), which stem from the layerINPUTs. Other than that, the rest is different.  Which means that Neuron1 could produce an output value close to 1, and at the same time Neuron2 could produce an output close to 0, e...