0
$\begingroup$

While training a keras model, i got this logs.

Epoch 49/50
2/2 [==============================] - 2s 943ms/step - loss: 1.1921e-07 - acc: 1.0000

As per my knowledge, i know that the ideal loss should be btw 1 to 10 (not sure) while training a model, but i faced this loss value while training in e-07.

Is this a valid training? Or I'm doing wrong somewhere ??

$\endgroup$
  • $\begingroup$ Do I understand correctly that your training accuracy is 1.00? If so, then you are severely overfitting. Loss is just a sum of errors, and your model doesn't seem to be making any, therefore such a small value. $\endgroup$ – Vlad_Z Aug 1 '19 at 14:13
  • $\begingroup$ Do you mean my model is Invalid for testing ? Will Severely overfitting cause wrong predictions ? $\endgroup$ – krishna rao gadde Aug 1 '19 at 14:21
  • $\begingroup$ Usually 100% accuracy in training is an indicator that the model has become too focused on the training data (effectively memorizing it) and will not be able to generalize well. The model is only as good as the predictions it makes based on previously unseen data. What is your validation accuracy? $\endgroup$ – Vlad_Z Aug 1 '19 at 14:30
  • $\begingroup$ My validation accuracy is bad. I can say its 50%. I have used this model for binary classification (Text classification). It is predicting only one class, all the time. I think that might be the training data to deal with.. But not sure !!! $\endgroup$ – krishna rao gadde Aug 1 '19 at 14:53
  • $\begingroup$ Actually I have realized one thing (not sure if this is correct or not) The training dataset i have has two classes. Each class has a single file in it which has all the data. But when i split files (say 1000 files having some data each), and added them in my training Class, The loss and accuracy are different as shown below. Epoch 48/50 3108/3108 [==============================] - 18s 6ms/step - loss: 0.0904 - acc: 0.9865 They are not in e-07. I think this is the right way of training the model. Split the files in classes not to maintain a single big training file. -What say everyone $\endgroup$ – krishna rao gadde Aug 1 '19 at 15:25
1
$\begingroup$

Loss is just a sum of errors that your model makes, so lower values are desirable. In your case, the training accuracy is 1.00, meaning that your model is making perfect predictions during training. No mistakes - no loss, so this is to be expected.

However, having 100% accuracy in training is usually an indication that the model has become too familiar with the training data, effectively memorizing it instead of learning to generalize. Such a model will most likely fail to make adequate predictions on data it hasn't seen before. Unless your validation accuracy is also around 100%, then you're severely overfitting. Great explanations that will get you started on interpreting loss and accuracy can be found here.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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