Direct way to calculate the performance of learner on training set?

Is there a way to get the accuracy/error rate on the training data for an image classifier problem. I have 12 classes in total. I am able to calculate the predictions of training data by:
probability_train, cat_train = learn.get_preds(DatasetType.Train)
Now, I am not sure how to get the true training labels. Maybe once I get those, I can calculate the error rate by just comparing actual and predicted tensors? Or there is some other way. Any help would be appreciated!

You already have the true training labels in the cat_train variable and you have your predicted probabilities in the probability_train variable. You can then calculate the error by passing them into a metric such as mse like so: mse(probability_train, cat_train).

If something is still unclear, try the docs: https://docs.fast.ai/basic_train.html#Learner.get_preds

Thanks! That works :slight_smile: