Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 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();
 }