private double determineError(TrainingSet trainingSet) {
double result = 0d;
Iterator<TrainingElement> iterator = trainingSet.iterator();
while (iterator.hasNext() && !isStopped()) {
SupervisedTrainingElement supervisedTrainingElement = (SupervisedTrainingElement) iterator
.next();
double[] input = supervisedTrainingElement.getInput();
this.neuralNetwork.setInput(input);
this.neuralNetwork.calculate();
double[] output = this.neuralNetwork.getOutput();
double[] desiredOutput = supervisedTrainingElement
.getDesiredOutput();
double[] patternError = this.getPatternError(output, desiredOutput);
this.updateTotalNetworkError(patternError);
double sqrErrorSum = 0;