You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/07/14 13:07:07 UTC
[GitHub] [incubator-mxnet] braindotai edited a comment on issue #15534: how
to get get train-acc and validation-acc per epoch explicitly per epoch?
braindotai edited a comment on issue #15534: how to get get train-acc and validation-acc per epoch explicitly per epoch?
URL: https://github.com/apache/incubator-mxnet/issues/15534#issuecomment-511201098
You can pass eval_data(your validation data) and eval_metric(metric for your validation data) in the `.fit` call method as below:
```python
# create a module
mod = mx.mod.Module(symbol=net,
context=mx.cpu(),
data_names=['data'],
label_names=['softmax_label'])
# fit the module
mod.fit(train_iter,
eval_data=val_iter,
optimizer='sgd',
optimizer_params={'learning_rate':0.1},
eval_metric='acc',
num_epoch=7)
```
Will print
```
INFO:root:Epoch[0] Train-accuracy=0.325437
INFO:root:Epoch[0] Time cost=0.550
INFO:root:Epoch[0] Validation-accuracy=0.568500
INFO:root:Epoch[1] Train-accuracy=0.622188
INFO:root:Epoch[1] Time cost=0.552
INFO:root:Epoch[1] Validation-accuracy=0.656500
```
For more info visit [here](https://mxnet.incubator.apache.org/versions/master/tutorials/basic/module.html)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services