'@return: accuracy and confusionMatrix as a tuple'

def accuracy(self, predictions, labels, need_confusion_matrix=False):

    _predictions = np.argmax(predictions, 1)
    _labels = np.argmax(labels, 1)
    cm = (confusion_matrix(_labels, _predictions) if need_confusion_matrix else None)
    accuracy = ((100.0 * np.sum((_predictions == _labels))) / predictions.shape[0])
    return (accuracy, cm)
