Dealing with Errors
The error-calculation methods allow you to determine the amount of variance between the expected and actual output of a neural network. In the next section, you will be shown how to train the neural network. Calling the error-calculation methods is the first step in training the neural network. Once the error has been determined, the network can be trained so the error will likely be lower next time.
There are two methods that are used for error calculation. The first is the error-calculation method called calcError. The calcError's signature is shown here.
public void calcError(double ideal[])
This method is to be called after each output set is presented during a training process. This method does not make any modifications to the weight matrix. Yet this method does store the "deltas" needed to modify the weight matrix so that the neural network will produce the ideal output better next time. To actually implement these changes, you must call the learn method of the neural network (covered in the next section).
You may want to calculate the root mean-square (RMS) error for a complete set of training data. Once you have submitted a number of a complete training set through the learning process, you can call the "getError" method to calculate the average error for the entire set. The signature for the "getError" method is as follows:
public double getError(int len)
Now that you have seen how to calculate errors, you are ready to see the methods that are used to train the neural network.