# Stats for training time and accuracy

Dear all,

Firstly, i want to get the total time of running 100 epoch, what would be the best code?

Second, what is the final accuracy result for running 100 epoch. is the best test/validation result on certain epoch?

for the first question:
maybe something like:

``````import time
training_start_time = time.time()
print('Training finished, took {:.2f}s'.format(time.time() - training_start_time))
``````

for the second question:
It kinda depends. If you want to get the best accuracy you can take it from a specific epoch. You can also calculate averages. Even the way my calculate accuracy can differ. You can, for example, take top1 accuracy or top5 accuracy. It’s really up to you

1 Like

i had right now four model running, as sample of my data is not that large, the best acc is all 0.9, which means nothing, should i get a overall accuracy of 100 epoch?

This is a https://paperswithcode.com/paper/dynamic-graph-cnn-for-learning-on-point/review/?hl=17002, how they evaluate the model acc. Do you know the formular of that?

thank you, but where should i put the training_start_time?

This is how i normally sum up my train time

``````dur = []
for epoch in range(1, 100):
t0 = time.time()
train(epoch)

dur.append(time.time() - t0)

print('Epoch: {:03d}, Train: {:.4f}, Test: {:.4f},Time(s) {:.4f}'.format(epoch,train_acc,test_acc,np.mean(dur)))
``````

when i use your code, it isn’t working

I checked the paper you linked. But they didn’t specify anything.
The shown results are:
Mean Per Class Accuracy: average of the accuracies of each class in your multi-class data set
Overall Accuracy: Your normal overall accuracy across all classes
Where there are measured/calculated is not specified

1 Like
``````dur = []
training_start_time = time.time()
for epoch in range(1, 100):
t0 = time.time()
train(epoch)

dur.append(time.time() - t0)

print('Epoch: {:03d}, Train: {:.4f}, Test: {:.4f},Time(s) {:.4f}'.format(epoch,train_acc,test_acc,np.mean(dur)))
print('Training finished, took {:.2f}s'.format(time.time() - training_start_time))
``````

Not directly related to your initial question, but if you want a more fancy way of tracking your training you can look into this.

Thank you so much!!!

and do you happen to know the way to save accuracy for each epoch, so i can load and calculate average later?