Example #1
0
        /// <summary> Calculates and adds the changes to make to this <see cref="Neuron"/> to the given <paramref name="neuronLayerChange"/> and <paramref name="weightLayerChange"/> using the given <paramref name="delta"/>. </summary>
        /// <param name="neuronLayerChange"> The changes to make to the containing <see cref="NeuronLayer"/>. </param>
        /// <param name="weightLayerChange"> The changes to make to the previous <see cref="WeightLayer"/>. </param>
        /// <param name="delta"> The calculated delta, used to calculate the desired change. </param>
        private void addChanges(NeuronLayerChange neuronLayerChange, WeightLayerChange weightLayerChange, float delta)
        {
            // Calculate the change in bias based on the delta.
            neuronLayerChange.AddBias(this, delta);

            // Calculate the changes to the input weights of this neuron.
            // The change to make is based on the output of the neuron to which the weight is connected. "Neurons that fire together, wire together".
            foreach (uint previousLayerNeuronID in NeuronLayer.PreviousWeightLayer.GetPreviousLayerConnections(this))
            {
                weightLayerChange.AddWeightChangeBetweenNeurons(previousNeuronLayer[previousLayerNeuronID], this, previousNeuronLayer[previousLayerNeuronID].Output * delta);
            }
        }