How do I access training loss when running learn.fit()

After running learn.fit(), I would like to have access to the resulting training loss, validation loss, accuracy.

If I go with:

result=learn.fit(…)

Then result will contain the validation loss and accuracy. How do I extract the training loss?

Ideally, those values would be accessible in my learner object, but I haven’t found them.

Haven’t found anything about this on the forums or the fastai code.

Thanks for helping!

you can use:

result, ep_vals = learn.fit(…, get_ep_vals=True)

Then you can get training and validation loss for each epoch.

You can see an example here just before the Test section heading where I plot these to get a feel for how things are progressing.

3 Likes

Fantastic, this is exactly what I was looking for, thank you.

Super useful ! Thanks @adrian.

I don’t think this option exists in the current api of learner. How can we access the results now.