AForge.Neuro.Learning.ResilientBackpropagationLearning.RunEpoch C# (CSharp) Method

RunEpoch() public method

Runs learning epoch.

The method runs one learning epoch, by calling Run method for each vector provided in the input array.

public RunEpoch ( double input, double output ) : double
input double Array of input vectors.
output double Array of output vectors.
return double
        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;
        }