Hello,
When I ran some mlp experiments using mxnet, I found it strange even I set the validation data the same as the training data, the outputted accuracy (which I think should be exactly the same) are very different. I also tried this in the example/module/mnist_mlp.py, by setting it as
mod.fit(train_dataiter, eval_data=train_dataiter,
optimizer_params={'learning_rate':0.01, 'momentum': 0.9}, num_epoch=n_epoch)
the output is as follows:
INFO:root:Epoch[0] Train-accuracy=0.126500
INFO:root:Epoch[0] Time cost=2.810
INFO:root:Epoch[0] Validation-accuracy=0.248550
INFO:root:Epoch[1] Train-accuracy=0.674233
INFO:root:Epoch[1] Time cost=2.833
INFO:root:Epoch[1] Validation-accuracy=0.843033
INFO:root:Epoch[2] Train-accuracy=0.885633
INFO:root:Epoch[2] Time cost=2.777
INFO:root:Epoch[2] Validation-accuracy=0.906350
INFO:root:Epoch[3] Train-accuracy=0.924400
INFO:root:Epoch[3] Time cost=2.719
Should the Train-accuracy be the same as the validation-accuracy each epoch?
Thanks!
Could be due to randomness, I would try ensure that you are using the same shuffle in both sets.
Training accuracy is calculated on every batch. Validation accuracy is calculated on the whole data iterator.
@VoVAllen Thanks for pointing this out ~
Most helpful comment
Training accuracy is calculated on every batch. Validation accuracy is calculated on the whole data iterator.