From ce54c9487f346074b0ed15c849ae7ec4bc032fc5 Mon Sep 17 00:00:00 2001 From: Shiran Yu Date: Mon, 23 Feb 2026 19:42:04 +0000 Subject: [PATCH 1/2] fix(losses): add missing docstring entries for default parameters - Add missing `alpha` parameter (default 2.0) to HausdorffDTLoss.__init__ docstring - Add "Defaults to X" notes to SoftclDiceLoss and SoftDiceclDiceLoss docstrings for `iter_`, `smooth`, and `alpha` parameters Signed-off-by: Shiran Yu --- monai/losses/cldice.py | 10 +++++----- monai/losses/hausdorff_loss.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/monai/losses/cldice.py b/monai/losses/cldice.py index 406cc3825f..c877567bbc 100644 --- a/monai/losses/cldice.py +++ b/monai/losses/cldice.py @@ -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_ @@ -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. """ super().__init__() self.iter = iter_ diff --git a/monai/losses/hausdorff_loss.py b/monai/losses/hausdorff_loss.py index c58be2d253..b75433e1da 100644 --- a/monai/losses/hausdorff_loss.py +++ b/monai/losses/hausdorff_loss.py @@ -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. From ef9f41d3c55672ac072a9e5494c9f05ce1eff64b Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Fri, 27 Feb 2026 10:45:50 +0000 Subject: [PATCH 2/2] Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- monai/losses/cldice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/losses/cldice.py b/monai/losses/cldice.py index c877567bbc..cb5a9e8c7a 100644 --- a/monai/losses/cldice.py +++ b/monai/losses/cldice.py @@ -161,8 +161,8 @@ def __init__(self, iter_: int = 3, alpha: float = 0.5, smooth: float = 1.0) -> N """ 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. """ super().__init__() self.iter = iter_