Skip to content

Commit f341546

Browse files
authored
Update docstring for include_background (#6573)
Fixes # . ### Description Now the docstring for `include_background` is as below, which may cause confusion, just update **skip** to **include**. > include_background (bool) – whether to skip Dice computation on the first channel of the predicted output. Defaults to True. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: KumoLiu <yunl@nvidia.com>
1 parent 5342680 commit f341546

10 files changed

Lines changed: 19 additions & 19 deletions

monai/handlers/confusion_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
"""
3636
3737
Args:
38-
include_background: whether to skip metric computation on the first channel of
38+
include_background: whether to include metric computation on the first channel of
3939
the predicted output. Defaults to True.
4040
metric_name: [``"sensitivity"``, ``"specificity"``, ``"precision"``, ``"negative predictive value"``,
4141
``"miss rate"``, ``"fall out"``, ``"false discovery rate"``, ``"false omission rate"``,

monai/handlers/metrics_reloaded_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(
3636
3737
Args:
3838
metric_name: Name of a binary metric from the MetricsReloaded package.
39-
include_background: whether to skip computation on the first channel of
39+
include_background: whether to include computation on the first channel of
4040
the predicted output. Defaults to ``True``.
4141
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
4242
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
@@ -84,7 +84,7 @@ def __init__(
8484
8585
Args:
8686
metric_name: Name of a categorical metric from the MetricsReloaded package.
87-
include_background: whether to skip computation on the first channel of
87+
include_background: whether to include computation on the first channel of
8888
the predicted output. Defaults to ``True``.
8989
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
9090
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,

monai/metrics/confusion_matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ConfusionMatrixMetric(CumulativeIterationMetric):
3737
Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
3838
3939
Args:
40-
include_background: whether to skip metric computation on the first channel of
40+
include_background: whether to include metric computation on the first channel of
4141
the predicted output. Defaults to True.
4242
metric_name: [``"sensitivity"``, ``"specificity"``, ``"precision"``, ``"negative predictive value"``,
4343
``"miss rate"``, ``"fall out"``, ``"false discovery rate"``, ``"false omission rate"``,
@@ -143,7 +143,7 @@ def get_confusion_matrix(y_pred: torch.Tensor, y: torch.Tensor, include_backgrou
143143
The values should be binarized.
144144
y: ground truth to compute the metric. It must be one-hot format and first dim is batch.
145145
The values should be binarized.
146-
include_background: whether to skip metric computation on the first channel of
146+
include_background: whether to include metric computation on the first channel of
147147
the predicted output. Defaults to True.
148148
149149
Raises:

monai/metrics/generalized_dice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def compute_generalized_dice(
113113
and in the NCHW[D] format, where N is the batch dimension, C is the channel dimension, and the
114114
remaining are the spatial dimensions.
115115
y (torch.Tensor): binarized ground-truth. It should be binarized, in one-hot format and have the same shape as `y_pred`.
116-
include_background (bool, optional): whether to skip score computation on the first channel of the
116+
include_background (bool, optional): whether to include score computation on the first channel of the
117117
predicted output. Defaults to True.
118118
weight_type (Union[Weight, str], optional): {``"square"``, ``"simple"``, ``"uniform"``}. Type of function to
119119
transform ground truth volume into a weight factor. Defaults to ``"square"``.

monai/metrics/hausdorff_distance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def compute_hausdorff_distance(
154154
should be binarized.
155155
y: ground truth to compute mean the distance. It must be one-hot format and first dim is batch.
156156
The values should be binarized.
157-
include_background: whether to skip distance computation on the first channel of
157+
include_background: whether to include distance computation on the first channel of
158158
the predicted output. Defaults to ``False``.
159159
distance_metric: : [``"euclidean"``, ``"chessboard"``, ``"taxicab"``]
160160
the metric used to compute surface distance. Defaults to ``"euclidean"``.

monai/metrics/meandice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DiceMetric(CumulativeIterationMetric):
3737
Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
3838
3939
Args:
40-
include_background: whether to skip Dice computation on the first channel of
40+
include_background: whether to include Dice computation on the first channel of
4141
the predicted output. Defaults to ``True``.
4242
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
4343
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
@@ -128,7 +128,7 @@ def compute_dice(
128128
y_pred: input data to compute, typical segmentation model output.
129129
`y_pred` can be single-channel class indices or in the one-hot format.
130130
y: ground truth to compute mean dice metric. `y` can be single-channel class indices or in the one-hot format.
131-
include_background: whether to skip Dice computation on the first channel of
131+
include_background: whether to include Dice computation on the first channel of
132132
the predicted output. Defaults to True.
133133
ignore_empty: whether to ignore empty ground truth cases during calculation.
134134
If `True`, NaN value will be set for empty ground truth cases.
@@ -188,7 +188,7 @@ def __init__(
188188
"""
189189
190190
Args:
191-
include_background: whether to skip the score on the first channel
191+
include_background: whether to include the score on the first channel
192192
(default to the value of `sigmoid`, False).
193193
sigmoid: whether ``y_pred`` are/will be sigmoid activated outputs. If True, thresholding at 0.5
194194
will be performed to get the discrete prediction. Defaults to False.

monai/metrics/meaniou.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MeanIoU(CumulativeIterationMetric):
3535
Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
3636
3737
Args:
38-
include_background: whether to skip IoU computation on the first channel of
38+
include_background: whether to include IoU computation on the first channel of
3939
the predicted output. Defaults to ``True``.
4040
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
4141
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
@@ -113,7 +113,7 @@ def compute_iou(
113113
should be binarized.
114114
y: ground truth to compute mean IoU metric. It must be one-hot format and first dim is batch.
115115
The values should be binarized.
116-
include_background: whether to skip IoU computation on the first channel of
116+
include_background: whether to include IoU computation on the first channel of
117117
the predicted output. Defaults to True.
118118
ignore_empty: whether to ignore empty ground truth cases during calculation.
119119
If `True`, NaN value will be set for empty ground truth cases.

monai/metrics/surface_dice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SurfaceDiceMetric(CumulativeIterationMetric):
4949
class_thresholds: List of class-specific thresholds.
5050
The thresholds relate to the acceptable amount of deviation in the segmentation boundary in pixels.
5151
Each threshold needs to be a finite, non-negative number.
52-
include_background: Whether to skip NSD computation on the first channel of the predicted output.
52+
include_background: Whether to include NSD computation on the first channel of the predicted output.
5353
Defaults to ``False``.
5454
distance_metric: The metric used to compute surface distances.
5555
One of [``"euclidean"``, ``"chessboard"``, ``"taxicab"``].
@@ -186,7 +186,7 @@ def compute_surface_dice(
186186
class_thresholds: List of class-specific thresholds.
187187
The thresholds relate to the acceptable amount of deviation in the segmentation boundary in pixels.
188188
Each threshold needs to be a finite, non-negative number.
189-
include_background: Whether to skip the surface dice computation on the first channel of
189+
include_background: Whether to include the surface dice computation on the first channel of
190190
the predicted output. Defaults to ``False``.
191191
distance_metric: The metric used to compute surface distances.
192192
One of [``"euclidean"``, ``"chessboard"``, ``"taxicab"``].

monai/metrics/surface_distance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class SurfaceDistanceMetric(CumulativeIterationMetric):
4242
Example of the typical execution steps of this metric class follows :py:class:`monai.metrics.metric.Cumulative`.
4343
4444
Args:
45-
include_background: whether to skip distance computation on the first channel of
45+
include_background: whether to include distance computation on the first channel of
4646
the predicted output. Defaults to ``False``.
4747
symmetric: whether to calculate the symmetric average surface distance between
4848
`seg_pred` and `seg_gt`. Defaults to ``False``.
@@ -148,7 +148,7 @@ def compute_average_surface_distance(
148148
should be binarized.
149149
y: ground truth to compute mean the distance. It must be one-hot format and first dim is batch.
150150
The values should be binarized.
151-
include_background: whether to skip distance computation on the first channel of
151+
include_background: whether to include distance computation on the first channel of
152152
the predicted output. Defaults to ``False``.
153153
symmetric: whether to calculate the symmetric average surface distance between
154154
`seg_pred` and `seg_gt`. Defaults to ``False``.

monai/metrics/wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MetricsReloadedWrapper(CumulativeIterationMetric):
3333
3434
Args:
3535
metric_name: Name of a metric from the MetricsReloaded package.
36-
include_background: whether to skip computation on the first channel of
36+
include_background: whether to include computation on the first channel of
3737
the predicted output. Defaults to ``True``.
3838
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
3939
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
@@ -82,7 +82,7 @@ class MetricsReloadedBinary(MetricsReloadedWrapper):
8282
8383
Args:
8484
metric_name: Name of a binary metric from the MetricsReloaded package.
85-
include_background: whether to skip computation on the first channel of
85+
include_background: whether to include computation on the first channel of
8686
the predicted output. Defaults to ``True``.
8787
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
8888
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,
@@ -186,7 +186,7 @@ class MetricsReloadedCategorical(MetricsReloadedWrapper):
186186
187187
Args:
188188
metric_name: Name of a categorical metric from the MetricsReloaded package.
189-
include_background: whether to skip computation on the first channel of
189+
include_background: whether to include computation on the first channel of
190190
the predicted output. Defaults to ``True``.
191191
reduction: define mode of reduction to the metrics, will only apply reduction on `not-nan` values,
192192
available reduction modes: {``"none"``, ``"mean"``, ``"sum"``, ``"mean_batch"``, ``"sum_batch"``,

0 commit comments

Comments
 (0)