Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fastai - plot validation and training accuracy

I have used Keras before, and then I plotted the training and validation accuracy of datasets this way—

plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])

I'm currently learning fastai, and have already plotted training and validation losses. But I don't know how to plot validation accuracy and training accuracy.

learn.recorder.plot_losses()

Would anyone please help?

like image 285
Arafat Hasan Avatar asked Sep 12 '25 11:09

Arafat Hasan


2 Answers

learn.recorder.plot_metrics()

will plot all the metrics that you'v specified in

learn = cnn_learner(data, models.resnet34,
    metrics=[accuracy, error_rate])
like image 96
Sirynka Avatar answered Sep 15 '25 00:09

Sirynka


Check out: https://forums.fast.ai/t/plotting-metrics-after-learning/69937/3

The function plot_metrics() by Ignacio Oguiza is detailed there. Without it, you'll get an error 'Learner' object has no attribute 'plot_metrics'

Once implemented, you can call plot_metrics() as Sirynka has mentioned:

learn.recorder.plot_metrics()

And you may get some nice charts: enter image description here

like image 20
Toren Avatar answered Sep 15 '25 00:09

Toren