- Hands-On Neural Network Programming with C#
- Matt R. Cole
- 64字
- 2025-02-24 05:32:27
Forward propagation
The following is our code for a basic forward propagation process:
private void ForwardPropagate(params double[] inputs)
{
var i = 0;
InputLayer?.ForEach(a =>a.Value = inputs[i++]);
HiddenLayers?.ForEach(a =>a.ForEach(b =>b.CalculateValue()));
OutputLayer?.ForEach(a =>a.CalculateValue());
}
To do ForwardPropagation, we basically sum all the inputs from each synapse and run the result through our Sigmoid function to get an output. The CalculateValue function does this for us.