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/03/19 18:00:24 UTC

[GitHub] [incubator-mxnet] nswamy commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API

nswamy commented on a change in pull request #14442: [MXNet-1349][WIP][Fit API]Add validation support and unit tests for fit() API
URL: https://github.com/apache/incubator-mxnet/pull/14442#discussion_r266815841
 
 

 ##########
 File path: python/mxnet/gluon/estimator/estimator.py
 ##########
 @@ -64,17 +65,21 @@ def __init__(self, net,
             self.loss = [loss]
         else:
             self.loss = loss or []
+            if not self.loss:
+                raise ValueError("No loss specified, refer to gluon.loss.Loss")
             for l in self.loss:
-                if not isinstance(loss, gluon.loss.Loss):
+                if not isinstance(l, gluon.loss.Loss):
                     raise ValueError("loss must be a Loss or a list of Loss, refer to gluon.loss.Loss")
 
         if isinstance(metrics, EvalMetric):
-            self.metrics = [metrics]
+            self.train_metrics = [metrics]
         else:
-            self.metrics = metrics or []
-            for metric in self.metrics:
+            self.train_metrics = metrics or []
+            for metric in self.train_metrics:
                 if not isinstance(metric, EvalMetric):
                     raise ValueError("metrics must be a Metric or a list of Metric, refer to mxnet.metric.EvalMetric")
+        # Use same metrics for validation
+        self.test_metrics = copy.deepcopy(self.train_metrics)
 
 Review comment:
   rename `self.test_metrics`-> `self.val_metrics` 

----------------------------------------------------------------
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