public void InterConnectionWeightRenewal(double learningRate, double decayRate) { InterConnectionMatrix += LayerActivationMatrix.Transpose() * LayerErrorMatrix * learningRate; Parallel.For(0, InterConnectionMatrix.RowCount, index => { InterConnectionMatrix[index, index] = 0; }); if (decayRate > 0) { Parallel.For(0, InterConnectionMatrix.RowCount, rowIndex => { for (int columnIndex = 0; columnIndex < InterConnectionMatrix.ColumnCount; columnIndex++) { if (InterConnectionMatrix[rowIndex, columnIndex] > 0) { InterConnectionMatrix[rowIndex, columnIndex] -= decayRate; } else if (InterConnectionMatrix[rowIndex, columnIndex] < 0) { InterConnectionMatrix[rowIndex, columnIndex] += decayRate; } } }); InterConnectionMatrix.CoerceZero(decayRate); } }
public virtual void Duplicate(Layer cloneLayer) { cloneLayer.LayerStroageMatrix = LayerStroageMatrix.Clone(); cloneLayer.LayerActivationMatrix = LayerActivationMatrix.Clone(); cloneLayer.LayerErrorMatrix = LayerErrorMatrix.Clone(); cloneLayer.BiasMatrix = BiasMatrix.Clone(); cloneLayer.InterConnectionMatrix = InterConnectionMatrix.Clone(); }