def calculate_accuracy(preds, labels): """ Calculate the accuracy of model predictions against true labels. Parameters: preds (np.array): The predicted label from the model labels (np.array): The true label Returns: accuracy (float): The accuracy as a percentage of the correct predictions. """ pred_flat = np.argmax(preds, axis=1).flatten() labels_flat = labels.flatten() accuracy = np.sum(pred_flat == labels_flat) / len(labels_flat) return accuracy