protected void FinaliseErrorFirstDerivatives(Step downstream)
{
// Calculating the dEj/dWij and dEi/dOi both requires a multiplication by the derivative of the activation function,
// it is done here once so it doesn't need to be done for each individual calculations.
// This turns dEk/dOk into dEk/dAk by multiplying it by dOk/dAk
for (int i = 0; i < downstream.ErrorDerivative.Length; i++)
{
double weightedInputs = downstream.WeightedInputs[i];
double activationDerivative = downstream.CalculateActivationDerivative(weightedInputs);
downstream.ErrorDerivative[i] *= activationDerivative;
}
}