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

#1

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!

0 Likes

Plotting train/validation loss & accuracy while training model?
(adrian) #2

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

#3

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

0 Likes

(Pierre Guillou) #4

Super useful ! Thanks @adrian.

0 Likes

(Sooraj Mangalath Subrahmannian) #5

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

0 Likes