Posts

Showing posts with the label Training

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 = ...