public double[] Gradient(double[] threshold)
 {
     double[] gradient = new double[threshold.Length];
     for (int i = 0; i < gradient.Length; i++)
     {
         gradient[i] = function.Gradient(threshold[i]);
     }
     return(gradient);
 }
Esempio n. 2
0
        public Matrix Gradient(Matrix x)
        {
            if (!x.IsVector())
            {
                throw new Exception();
            }
            Matrix ret = new Matrix(x.GetRowCount(), x.GetColumnCount());

            for (int i = 0; i < ret.GetRowCount(); i++)
            {
                ret[i, 0] = function.Gradient(x[i, 0]);
            }
            return(ret);
        }
Esempio n. 3
0
 public override NDArray <Type> Backward(NDArray <Type> accumGrad)
 {
     return(accumGrad * activation.Gradient(layerInput));
 }
Esempio n. 4
0
 internal double Gradient(double x)
 {
     return(function.Gradient(x));
 }