public int numberOfErrors(ErrorType errorType, OutputVariable outputVariable) {
        if (!canComputeErrors()) {
            return -1;
        }
        int errors = 0;
        final int offset = engine.numberOfInputVariables();
        for (int i = 0; i < expected.size(); ++i) {
            double[] e = expected.get(i);
            double[] o = obtained.get(i);
            for (int y = 0; y < engine.numberOfOutputVariables(); ++y) {
                if (outputVariable == null
                        || outputVariable == engine.getOutputVariable(y)) {

                    if (!Op.isEq(e[offset + y], o[offset + y], tolerance)) {
                        double difference = e[offset + y] - o[offset + y];
                        if (errorType == ErrorType.Accuracy && Op.isFinite(difference)) {
                            ++errors;
                        } else if (errorType == ErrorType.NonFinite && !Op.isFinite(difference)) {
                            ++errors;
                        } else if (errorType == ErrorType.All) {
                            ++errors;
                        }
                    }
                }
            }
        }
        return errors;
    }
public int numberOfErrors ( ErrorType errorType , OutputVariable outputVariable ) { if ( ! canComputeErrors ( ) ) { return - 1 ; } int errors = 0 ; final int offset = engine . numberOfInputVariables ( ) ; for ( int i = 0 ; i < expected . size ( ) ; ++ i ) { double [ ] e = expected . get ( i ) ; double [ ] o = obtained . get ( i ) ; for ( int y = 0 ; y < engine . numberOfOutputVariables ( ) ; ++ y ) { if ( outputVariable == null || outputVariable == engine . getOutputVariable ( y ) ) { if ( ! Op . isEq ( e [ offset + y ] , o [ offset + y ] , tolerance ) ) { double difference = e [ offset + y ] - o [ offset + y ] ; if ( errorType == ErrorType . Accuracy && Op . isFinite ( difference ) ) { ++ errors ; } else if ( errorType == ErrorType . NonFinite && ! Op . isFinite ( difference ) ) { ++ errors ; } else if ( errorType == ErrorType . All ) { ++ errors ; } } } } } return errors ; }
Computes the number of errors of the given type over the given output
variable.

@param errorType is type of error to account for
@param outputVariable is output variable to account the errors for
@return the number of errors over the given output variable