Exemplo n.º 1
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();
 }
Exemplo n.º 2
0
        public virtual void BiasRenewal(double learningRate, double decayRate)
        {
            BiasMatrix += LayerErrorMatrix.ColumnSums().ToRowMatrix() * learningRate;

            if (decayRate > 0)
            {
                Parallel.For(0, BiasMatrix.ColumnCount, columnIndex =>
                {
                    if (BiasMatrix[0, columnIndex] > 0)
                    {
                        BiasMatrix[0, columnIndex] -= decayRate;
                    }
                    else if (BiasMatrix[0, columnIndex] < 0)
                    {
                        BiasMatrix[0, columnIndex] += decayRate;
                    }
                });
                BiasMatrix.CoerceZero(decayRate);
            }
        }