0

I have seen and used plots to measure the performance ( ie: accuracy, etc. ) of a model over epochs, but i have also seen certain papers discussing the progress of accuracy performance over the number of training samples. How should i proceed to produce such graph using keras or other common deep learning libraries?

Is this a way to fairly compare several models over the number of training samples they would need to reach satisfactory performance ?

1 Answers1

0

The model.fit call produces a history object, which includes loss and metric values for each epoch. Take a look at https://stackoverflow.com/a/56807595/5666087 for an answer to a similar question.

The relevant code sample from that answer is:

import keras
import matplotlib.pyplot as plt
history = model.fit(x, y, epochs=10)
plt.plot(history.history['accuracy'])
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.show()

It is not clear what you mean by plotting over number over training samples. Do you mean over the number of samples the model has seen? In that case, you can plot over number of epochs, and the number of samples the model has seen is the number of training samples multiplied by the number of epochs. If you are training multiple models with access to varying amounts of training samples, you can plot multiple lines, one per model.

jkr
  • 17,119
  • 2
  • 42
  • 68
  • thank you for your suggestion. Yes thats what i meant. I was under the impression that there could exist a straightforward method by using history object. – Kazihise Guy-Fernand Feb 01 '20 at 05:27
  • Could you direct me to some pointers, as to how to produce those various amounts of training samples ? Namely, how to fairly(randomly?) produce those batches of samples with increasing amount samples at each turn ? – Kazihise Guy-Fernand Feb 01 '20 at 05:40