Pytorch -Visualising test error

I am running code that trains a model which print a test count error and count error. I would like to visualise this data. What is the best way to do this please? I am quite new to Pytorch and help would be greatly appreciated.

Have you looked into Tensorboard?

Thanks! I have had a look but not sure which bit of the code i need to integrate to my code?

Cnange the randoms to values to your loss values.

from torch.utils.tensorboard import SummaryWriter
import numpy as np

writer = SummaryWriter()

for n_iter in range(100):
    writer.add_scalar('Loss/train', np.random.random(), n_iter)
    writer.add_scalar('Loss/test', np.random.random(), n_iter)
    writer.add_scalar('Accuracy/train', np.random.random(), n_iter)
    writer.add_scalar('Accuracy/test', np.random.random(), n_iter)

Thanks for your help! Do i include this in the same file as my training model? And once the training is done i issue the command line tensorboard --logdir=runs to get the dashboard? Thanks

1 Like

Yep, that’s correct. Check out the documentation for a full list of what you can do.