metrics.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:tefla 作者: openAGI 项目源码 文件源码
def metric(self, predictions, targets, num_classes=5):
        """
        Computes auroc metric

        Args:
            predictions: 2D tensor/array, predictions of the network
            targets: 2D tensor/array, ground truth labels of the network
            num_classes: int, num_classes of the network

        Returns:
            auroc score
        """
        if targets.ndim == 2:
            targets = np.argmax(targets, axis=1)
        if predictions.ndim == 1:
            predictions = one_hot(predictions, m=num_classes)
        return self._auroc(predictions, targets)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号