From d3d5439c702d722752b8a0159665f6607f1c08b4 Mon Sep 17 00:00:00 2001 From: liutongtong Date: Wed, 24 Nov 2021 17:00:43 +0800 Subject: [PATCH] fix comments in metric --- mindspore/nn/metrics/confusion_matrix.py | 8 ++++---- mindspore/nn/metrics/mean_surface_distance.py | 4 ++-- mindspore/nn/metrics/recall.py | 2 +- mindspore/nn/metrics/root_mean_square_surface_distance.py | 2 +- mindspore/nn/metrics/topk.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mindspore/nn/metrics/confusion_matrix.py b/mindspore/nn/metrics/confusion_matrix.py index 17398e82254..d13f89672bb 100644 --- a/mindspore/nn/metrics/confusion_matrix.py +++ b/mindspore/nn/metrics/confusion_matrix.py @@ -162,15 +162,15 @@ class ConfusionMatrixMetric(Metric): skip_channel (bool): Whether to skip the measurement calculation on the first channel of the predicted output. Default: True. metric_name (str): Names of supported metrics , users can also set the industry common aliases for them. Choose - from: ["sensitivity", "specificity", "precision", "negative predictive value", "miss rate", + from: ["sensitivity", "specificity", "precision", "negative predictive value", "miss rate", "fall out", "false discovery rate", "false omission rate", "prevalence threshold", "threat score", "accuracy", "balanced accuracy", "f1 score", "matthews correlation coefficient", "fowlkes mallows index", "informedness", "markedness"]. calculation_method (bool): If true, the measurement for each sample will be calculated first. - If not, the confusion matrix of all samples will be accumulated first. - As for classification task, 'calculation_method' should be False. Default: False. + If not, the confusion matrix of all samples will be accumulated first. + As for classification task, 'calculation_method' should be False. Default: False. decrease (str): The reduction method on data batch. `decrease` takes effect only when calculation_method - is True. Default: "mean". Choose from: + is True. Default: "mean". Choose from: ["none", "mean", "sum", "mean_batch", "sum_batch", "mean_channel", "sum_channel"]. Supported Platforms: diff --git a/mindspore/nn/metrics/mean_surface_distance.py b/mindspore/nn/metrics/mean_surface_distance.py index d8470b72c15..2f40766ce93 100644 --- a/mindspore/nn/metrics/mean_surface_distance.py +++ b/mindspore/nn/metrics/mean_surface_distance.py @@ -25,7 +25,7 @@ class MeanSurfaceDistance(Metric): on average, the surface varies between the segmentation and the GT (ground truth). Given two sets A and B, S(A) denotes the set of surface voxels of A. The shortest distance of an arbitrary voxel v - to S(A) is defined as: + to S(A) is defined as: .. math:: {\text{dis}}\left (v, S(A)\right ) = \underset{s_{A} \in S(A)}{\text{min }}\rVert v - s_{A} \rVert \ @@ -36,7 +36,7 @@ class MeanSurfaceDistance(Metric): AvgSurDis(B\rightarrow A) = \frac{\sum_{s_{B} \in S(B)}^{} {\text{dis} \ left ( s_{B}, S(A) \right )} } {\left | S(B) \right |} - Where the ||*|| denotes a distance measure. |*| denotes the number of elements. + Where the \|\|\*\|\| denotes a distance measure. \|\*\| denotes the number of elements. The mean of surface distance form set(B) to set(A) and from set(A) to set(B) is: diff --git a/mindspore/nn/metrics/recall.py b/mindspore/nn/metrics/recall.py index dc41567a03b..cc733ad179b 100644 --- a/mindspore/nn/metrics/recall.py +++ b/mindspore/nn/metrics/recall.py @@ -38,7 +38,7 @@ class Recall(EvaluationBase): Args: eval_type (str): 'classification' or 'multilabel' are supported. Default: 'classification'. - Default: 'classification'. + Default: 'classification'. Examples: >>> import numpy as np diff --git a/mindspore/nn/metrics/root_mean_square_surface_distance.py b/mindspore/nn/metrics/root_mean_square_surface_distance.py index bb571ed091d..b1d3ce0617e 100644 --- a/mindspore/nn/metrics/root_mean_square_surface_distance.py +++ b/mindspore/nn/metrics/root_mean_square_surface_distance.py @@ -35,7 +35,7 @@ class RootMeanSquareDistance(Metric): RmsSurDis(B \rightarrow A) = \sqrt{\frac{\sum_{s_{B} \in S(B)}^{} {\text{dis}^2 \left ( s_{B}, S(A) \right )} }{\left | S(B) \right |}} - Where the ||\*|| denotes a distance measure. |\*| denotes the number of elements. + Where the \|\|\*\|\| denotes a distance measure.\ |\*\| denotes the number of elements. The Root Mean Square Surface Distance form set(B) to set(A) and from set(A) to set(B) is: diff --git a/mindspore/nn/metrics/topk.py b/mindspore/nn/metrics/topk.py index 7c647780923..f8076e652c3 100644 --- a/mindspore/nn/metrics/topk.py +++ b/mindspore/nn/metrics/topk.py @@ -66,7 +66,7 @@ class TopKCategoricalAccuracy(Metric): Updates the internal evaluation result `y_pred` and `y`. Args: - inputs: Input `y_pred` and `y`. ` y_pred` and `y` are Tensor, list or numpy.ndarray. + inputs: Input `y_pred` and `y`. `y_pred` and `y` are Tensor, list or numpy.ndarray. `y_pred` is in most cases (not strictly) a list of floating numbers in range :math:`[0, 1]` and the shape is :math:`(N, C)`, where :math:`N` is the number of cases and :math:`C` is the number of categories. `y` contains values of integers. The shape is :math:`(N, C)`