Why the training error is greater than the test error?

Viewed 25

I have trained a model in mode .train() (nn.Models of Pytorch) I have saved the BCELoss (in mode .train()) and the accuracies on ds test and on ds train (but in mode .eval() ). So, the results were:

(for example in epoch 153) error classification (train, test): 0.5819954128440368 , 0.37209302325581395

and the loss was: 0.0032386823306408906

How was it possibile? Was I wrong to switch the two modes? Is this the problem?

1 Answers

Test error is not always greater than train error, but it seems that your loss function or model structure has some problem considering that you trained your model for 153 epoches.

Why don't you design a new layer structure, referring lots of publication ? In my experience your problem usually occurs when your model is not the optimized model for your dataset. It is not solved by simply enhancing the depth of model.

Related