public BackpropagationLayer(Backpropagation parent, FeedforwardLayer layer) { this.parent = parent; this.layer = layer; error = new double[layer.NeuronCount]; errorDelta = new double[layer.NeuronCount]; if (layer.Next != null) { accumulatedMatrixDelta = new Matrix(layer.NeuronCount + 1, layer.Next.NeuronCount); previousMatrixDelta = new Matrix(layer.NeuronCount + 1, layer.Next.NeuronCount); biasRow = layer.NeuronCount; } }
public void Learn(double learnRate, double momentum) { if (layer.HasMatrix) { previousMatrixDelta = (accumulatedMatrixDelta * learnRate) + (previousMatrixDelta * momentum); layer.LayerMatrix = layer.LayerMatrix.Add(previousMatrixDelta); accumulatedMatrixDelta.Clear(); } }
public void Learn(double learnRate, double momentum) { if (_layer.HasMatrix) { _previousMatrixDelta = (_accumulatedMatrixDelta * learnRate) + (_previousMatrixDelta * momentum); _layer.LayerMatrix = _layer.LayerMatrix.Add(_previousMatrixDelta); _accumulatedMatrixDelta.Clear(); } }