public double Evaluate(ref Dictionary <int, Neuron> neurons, ref Dictionary <int, Connection> connections)
 {
     if (!biasAllowed)
     {
         bias = 0;
     }
     if (tFuncType == TransferFuncType.MAXPOOL)
     {
         int    cFinalIdx = -1;
         double finalOut  = int.MinValue;
         foreach (int cIdx in incomingConnection)
         {
             connections[cIdx].weight = 0;
             foreach (int key in connections[cIdx].srcDest.Keys)
             {
                 int srcIdx = key;
                 if (neurons[srcIdx].output > finalOut)
                 {
                     finalOut  = neurons[srcIdx].output;
                     cFinalIdx = cIdx;
                 }
             }
         }
         connections[cFinalIdx].weight = 1;
         output = finalOut;
         return(output);
     }
     if (tFuncType != TransferFuncType.NONE)
     {
         input += bias;
     }
     output = TransferFunction.Evaluate(tFuncType, input);
     return(output);
 }
 public double EvaluateDerivative()
 {
     if (tFuncType == TransferFuncType.MAXPOOL)
     {
         return(1);
     }
     if (tFuncType == TransferFuncType.SIGMOID || tFuncType == TransferFuncType.SOFTMAX)
     {
         return(output * (1 - output));
     }
     return(TransferFunction.EvaluateDerivate(tFuncType, input));
 }