public double Run(double[] input, double[] output)
{
// zero gradient
ResetGradient();
// compute the network's output
network.Compute(input);
// calculate network error
double error = CalculateError(output);
// calculate weights updates
CalculateGradient(input);
// update the network
UpdateNetwork();
// return summary error
return error;
}