2
$\begingroup$

I am training model to classify fruit images belonging to 60 classes. I have this result:

enter image description here

Validation accuracy is greater than training accuracy. Does this mean underfitting? If yes, can I fix this by adding more layers to the neural network or by increasing the number of neurons?

$\endgroup$
2
  • 1
    $\begingroup$ Please post your model. $\endgroup$
    – Peter
    May 7, 2020 at 15:59
  • $\begingroup$ I believe the model can do better. However, if this accuracy metric doesn't give satisfactory results, you can absolutely opt to measure other performance metrics. $\endgroup$ May 7, 2020 at 18:15

3 Answers 3

2
$\begingroup$

It seems weird.

Your validation has a higher score than your training. This literally means that your model performs better in unseen data than what it sees.

Typical underfitting is that you achieve the same in train than in test.

In my opinion, since you are not providing much information, you are not splitting right the data. It might be for a lot of reasons:

  • The test is too small or too easy to predict
  • There is a temporal dependency and you are not using it (data leakage).
  • There are groups in your dataset and you are splitting by groups...

And a thousand more. From the visualizations that you are adding my guess your train test split is not performed correctly

$\endgroup$
1
$\begingroup$

Can I ask you if you are using any form of dropout? It happened to me before that because I did apply dropout to the training set, but not on the validation set, I would easily get higher accuracy in the validation

$\endgroup$
3
  • $\begingroup$ I am not using Dropout layer because as I understand it is used when there is overfitting $\endgroup$ May 8, 2020 at 6:52
  • $\begingroup$ It is used as a regularization, so ye it would help for overfitting and generalizing better... Anyway, i do not think it's underfitting... It might be just what @Carlos Mougan suggested, but there are other possible causes as well I would suggest you give a read to this article: pyimagesearch.com/2019/10/14/… They have a lot of examples in which this can happen $\endgroup$
    – raff7
    May 8, 2020 at 9:03
  • $\begingroup$ Okey thank you for the link. I will read the article. $\endgroup$ May 8, 2020 at 9:51
0
$\begingroup$

You might be underfitting and so have to (at least) train for a longer time (more epochs). Are you calculating your accuracy in the training set before calculating the for the testing set (as the case in many neural network implementation)? Is each training accuracy a mean from many training steps? If this is the case and you are not overfitting (too much), it is expected that you will have slightly better accuracy in the test set as the model has been improved through training. However, more information on how you implement the model would be great.

$\endgroup$

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.