sandeep-krishnamurthy commented on a change in pull request #13471:
Optimization of metric evaluation
URL: https://github.com/apache/incubator-mxnet/pull/13471#discussion_r239666640
##########
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:
If user calls specifically global statistics and if it is not available,
shouldn't we throw exception than silently return local? Same in other places.
----------------------------------------------------------------
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