sethah commented on issue #9777: Mx 9588
URL: https://github.com/apache/incubator-mxnet/pull/9777#issuecomment-365147592
 
 
   Regarding other approaches, something I looked at was the following:
   
   ```python
   class MacroMetric(EvalMetric):
   
       def __init__(self, base_metric):
           super(MacroMetric, self).__init__("macro_" + base_metric.name, 
output_names=base_metric.output_names,
                                             
label_names=base_metric.label_names)
           self.base_metric = base_metric
   
       def update(self, labels, preds):
           self.base_metric.update(labels, preds)
           self.sum_metric += self.base_metric.get()[1]
           self.num_inst += 1
           self.base_metric.reset()
   ```
   
   Any metric that has defined the "micro" behavior can then be used as "macro" 
just by calling `metric = mx.metric.MacroMetric(mx.metric.F1())`, but that 
seems pretty awkward for the users, and also changes the default behavior to 
micro, which doesn't work for backwards compatibility. The current solution 
works well enough, and we could probably revisit in a later PR if needed.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to