How can I make "fit_one_cycle" also plot the metric for the training data?

Notice how it shows the loss for both train and valid, but only shows “accuracy” for valid:

Screen Shot 2021-05-04 at 9.37.23 PM

How can I make it show “accuracy” for both train and valid?

Hi Victor,

Good Day!

You could basically inherit the Callback class and just implement the after_train method to compute whatever metric you like by putting the model to eval mode and doing forward passes.

Just don’t forget to put the model back to train() mode before you end the function definition of after_eval. This can help you store all the metrics at the end of every epoch on both train and validation data.

However you’ll have to print out the data to the screen; I don’t know how to add it to the dataframe above but basically yeah you can print it out to have a look.

Hope this helps!

Thanks,
Vinayak.