singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] nudles opened a new issue #702: Update the metric module
Date Sun, 17 May 2020 10:40:27 GMT

nudles opened a new issue #702:
URL: https://github.com/apache/singa/issues/702


   It would be better to implement a metric as a function in the metric.py as metric typically
has not states. Therefore, no need to make it as a class. e.g,
   
   ```python
   def accuracy(y_pred, y_true):
      """compute the accuracy.
   
        Args:
           y_pred(numpy array or tensor): each value is a label index
           y_true(numpy array or tensor): each value is a label index
      """
         check shape match
         convert y_pred and y_true to np array     
         return np.sum(y_pred== y_true) / y_true.shape[0]
   ```
   Refer to https://keras.io/api/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



Mime
View raw message