Added logic in computing error rate in prediction