- Hands-On Neural Network Programming with C#
- Matt R. Cole
- 42字
- 2025-02-24 05:32:27
Calculating a gradient
The gradient is calculated by considering the Derivative of the Sigmoid function:
public double CalculateGradient(double? target = null)
{
if (target == null)
return Gradient = OutputSynapses.Sum(a =>a.OutputNeuron.Gradient *
a.Weight) * Sigmoid.Derivative(Value);
return Gradient = CalculateError(target.Value) * Sigmoid.Derivative(Value);
}