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/10/31 18:26:18 UTC
[GitHub] [incubator-mxnet] szha commented on a change in pull request
#16676: [Estimator] handle composite metrics in estimator
szha commented on a change in pull request #16676: [Estimator] handle composite metrics in estimator
URL: https://github.com/apache/incubator-mxnet/pull/16676#discussion_r341300511
##########
File path: tests/nightly/estimator/test_sentiment_rnn.py
##########
@@ -190,10 +190,11 @@ def run(net, train_dataloader, test_dataloader, num_epochs, ctx, lr):
trainer = mx.gluon.Trainer(net.collect_params(), 'adam', {'learning_rate': lr})
# Define loss and evaluation metrics
loss = gluon.loss.SoftmaxCrossEntropyLoss()
- acc = mx.metric.Accuracy()
+ metrics = mx.metric.CompositeEvalMetric()
+ metrics.add([mx.metric.Accuracy(), mx.metric.Loss()])
# Define estimator
- est = estimator.Estimator(net=net, loss=loss, metrics=acc,
+ est = estimator.Estimator(net=net, loss=loss, metrics=metrics,
trainer=trainer, context=ctx)
# Begin training
est.fit(train_data=train_dataloader, val_data=test_dataloader,
Review comment:
resolved. also added handling for nested composite metrics case.
----------------------------------------------------------------
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