I want to understand how to analyse the loss and accuracy (any metric) graphs that we plot from the model training history. Here's my graph, enter image description here

What can we say from the slope of graph? Does it matter? As you can see the validation and training loss-accuracy are pretty much the same for the most part. What does this mean? Usually the val accuracy is higher than training accuracy in the beginning but we don't see that here. Am I doing something wrong? (the validation and training datasets are different)

for the reference I am doing binary classification using a neural net using following code

model = Sequential()
model.add(Dense(batch_size, input_shape = (batch_size, 37)))
model.add(Dense(256, activation= 'relu'))
model.add(Dense(512, activation= 'relu'))
model.add(Dense(512, activation= 'relu'))
model.add(Dense(256, activation= 'relu'))
model.add(Dense(128, activation= 'relu'))
model.add(Dense(1, activation= 'sigmoid'))

model.compile(optimizer= 'adam', loss='binary_crossentropy', metrics= ['accuracy'])

The data contains both categorical and continuous variables.


1 Answer 1

  • A basic principle in supervised evaluation is to evaluate on a different data than the training set. This is because the model can overfit, i.e. learn details which happen by chance in the training set instead of real important patterns. Overfitting is detected by observing whether there is a large difference between performance on the training data and performance on a test (or validation) set. So when the two curves are close like in your case, it means that there is no or little overfitting (which is good, of course).
    • Note that sometimes the curves are close because the validation data is influenced by the training data, this is a different issue called data leakage. Basically the validation (or test) data is invalid/corrupted.
  • The slope represents how fast the model reaches its best performance. Apart from the question of computational complexity, what matters is to observe that the performance becomes more or less stable at some point. For example, if you had stopped the training at 50 epochs, then there wouldn't be any stabilization of the performance, meaning that the training was stopped too early. On the contrary, it can be seen in your graphs that performance becomes stable somewhere around epoch 90. There's even a little bit of overfitting happening after this, because the model keeps trying to improve but actually starts learning "details" from the training set.
  • As a side note, the accuracy score can sometimes be misleading: it's just the proportion of correct instances, so its interpretation is difficult if the two classes are not balanced (i.e, have proportions close to 50/50).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.