ptrendx commented on a change in pull request #13471: Optimization of metric 
evaluation
URL: https://github.com/apache/incubator-mxnet/pull/13471#discussion_r240338631
 
 

 ##########
 File path: python/mxnet/metric.py
 ##########
 @@ -164,6 +173,24 @@ def get(self):
         else:
             return (self.name, self.sum_metric / self.num_inst)
 
+    def get_global(self):
+        """Gets the current global evaluation result.
+
+        Returns
+        -------
+        names : list of str
+           Name of the metrics.
+        values : list of float
+           Value of the evaluations.
+        """
+        if self._has_global_stats:
+            if self.global_num_inst == 0:
+                return (self.name, float('nan'))
+            else:
+                return (self.name, self.global_sum_metric / 
self.global_num_inst)
+        else:
+            return self.get()
 
 Review comment:
   I'm not sure if that is possible - doing this would break fully custom 
metrics (other than subclasses of `CustomMetric` class, for which I added 
support) that did not implement global stats.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to