
上QQ阅读APP看书,第一时间看更新
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.