Skip to content

Commit 1415eec

Browse files
committed
Add docstring for AsymmetricMeasureMixin
1 parent f9a67b4 commit 1415eec

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

docs/source/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Minimum supported Python version is now 3.8 due to type linting.
8484
Replace the ``ObjectBasedDistanceMeasure`` class by the more general ``segmetrics.measure.ObjectMeasureAdapter`` class.
8585

8686
Add ``.object_based()`` method for all image-level measures (including region-based measures).
87+
The method does not accept positional arguments any more, only keyword arguments.
8788

8889
Remove the argument and attribute ``mode`` from the Hausdorff distance.
8990

segmetrics/measure.py

+34-4
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ def __init__(
127127

128128
def object_based(self, **kwargs) -> Measure:
129129
"""
130-
Returns measure for comparison regarding the individual objects (as
131-
opposed to only considering their union).
130+
Returns measure for comparing the individual objects (as opposed to
131+
only considering the union thereof).
132132
133-
Positional and keyword arguments are passed through to
134-
:class:`ObjectMeasureAdapter`.
133+
Keyword arguments are passed through to :class:`ObjectMeasureAdapter`.
135134
136135
:returns:
137136
This measure decorated by :class:`ObjectMeasureAdapter`.
@@ -147,11 +146,42 @@ def object_based(self, **kwargs) -> Measure:
147146

148147

149148
class AsymmetricMeasureMixin(MeasureProtocol):
149+
"""
150+
Defines an asymmetric performance measure.
151+
152+
Symmetric performance measures are guaranteed to yield the same results
153+
when the actual and the expected segmentation masks are swapped.
154+
Asymmetric performance measures can yield different results when the
155+
results are swapped.
156+
"""
150157

151158
def reversed(self, **kwargs) -> Measure:
159+
"""
160+
Returns a measure for comparing the underlying asymmetric performance
161+
measure measure in the opposite direction (i.e. swapping the actual
162+
and the expected segmentation masks).
163+
164+
Keyword arguments are passed through to :class:`ReverseMeasureAdapter`.
165+
166+
:returns:
167+
This measure decorated by :class:`ReverseMeasureAdapter`.
168+
"""
152169
return ReverseMeasureAdapter(self, **kwargs)
153170

154171
def symmetric(self, **kwargs) -> Measure:
172+
"""
173+
Returns a bidirectional variant of the underlying asymmetric
174+
performance measure. The underlying performance measure is used for
175+
computation of performance values in both direction (i.e. with the
176+
original segmentation masks, and, in addition, with actual and
177+
expected segmentation masks swapped).
178+
179+
Keyword arguments are passed through to
180+
:class:`SymmetricMeasureAdapter`.
181+
182+
:returns:
183+
This measure decorated by :class:`SymmetricMeasureAdapter`.
184+
"""
155185
return SymmetricMeasureAdapter(self, self.reversed(), **kwargs)
156186

157187

0 commit comments

Comments
 (0)