public double RunEpoch(double[][] input, double[][] output)
{
// zero gradient
ResetGradient();
double error = 0.0;
// run learning procedure for all samples
for (int i = 0; i < input.Length; i++)
{
// compute the network's output
network.Compute(input[i]);
// calculate network error
error += CalculateError(output[i]);
// calculate weights updates
CalculateGradient(input[i]);
}
// update the network
UpdateNetwork();
// return summary error
return error;
}