Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions monai/losses/cldice.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ class SoftclDiceLoss(_Loss):
def __init__(self, iter_: int = 3, smooth: float = 1.0) -> None:
"""
Args:
iter_: Number of iterations for skeletonization
smooth: Smoothing parameter
iter_: Number of iterations for skeletonization. Defaults to 3.
smooth: Smoothing parameter. Defaults to 1.0.
"""
super().__init__()
self.iter = iter_
Expand Down Expand Up @@ -160,9 +160,9 @@ class SoftDiceclDiceLoss(_Loss):
def __init__(self, iter_: int = 3, alpha: float = 0.5, smooth: float = 1.0) -> None:
"""
Args:
iter_: Number of iterations for skeletonization
smooth: Smoothing parameter
alpha: Weighing factor for cldice
iter_: Number of iterations for skeletonization. Defaults to 3.
smooth: Smoothing parameter. Defaults to 1.0.
alpha: Weighing factor for cldice. Defaults to 0.5.
Comment on lines +163 to +165
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Docstring parameter order doesn't match the signature.

The signature declares alpha before smooth, but the docstring lists smooth first. Swap to keep them aligned.

📝 Proposed fix
         Args:
             iter_: Number of iterations for skeletonization. Defaults to 3.
-            smooth: Smoothing parameter. Defaults to 1.0.
             alpha: Weighing factor for cldice. Defaults to 0.5.
+            smooth: Smoothing parameter. Defaults to 1.0.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
iter_: Number of iterations for skeletonization. Defaults to 3.
smooth: Smoothing parameter. Defaults to 1.0.
alpha: Weighing factor for cldice. Defaults to 0.5.
iter_: Number of iterations for skeletonization. Defaults to 3.
alpha: Weighing factor for cldice. Defaults to 0.5.
smooth: Smoothing parameter. Defaults to 1.0.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@monai/losses/cldice.py` around lines 163 - 165, The docstring parameter list
is out of order: the function/class signature declares alpha before smooth, but
the docstring lists smooth first; update the docstring in monai/losses/cldice.py
to list alpha before smooth (and ensure the descriptions match the signature
order for parameters alpha and smooth, e.g., alpha: ... then smooth: ...),
referencing the initializer/function name (CLDice or its __init__/forward where
the signature appears) so the docstring aligns with the actual parameter order.

"""
super().__init__()
self.iter = iter_
Expand Down
1 change: 1 addition & 0 deletions monai/losses/hausdorff_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(
) -> None:
"""
Args:
alpha: the exponent to transform the distance when computing the loss. Defaults to 2.0.
include_background: if False, channel index 0 (background category) is excluded from the calculation.
if the non-background segmentations are small compared to the total image size they can get overwhelmed
by the signal from the background so excluding it in such cases helps convergence.
Expand Down
Loading