Skip to content

Incorrect gamma default values in unified_focal_loss.py docstrings #8689

Description

@aymuos15

Description

The docstrings in monai/losses/unified_focal_loss.py have incorrect default values for the gamma parameter. The code defaults are correct (matching the original author's implementation referenced in #4413), but the docstrings incorrectly state 0.75 for all classes.

Comparison with Original Implementation

Loss Function Original Default γ MONAI Code MONAI Docstring
AsymmetricFocalLoss 2.0 gamma: float = 2 "Defaults to 0.75" ✗
AsymmetricFocalTverskyLoss 0.75 gamma: float = 0.75 "Defaults to 0.75" ✓
AsymmetricUnifiedFocalLoss 0.5 gamma: float = 0.5 "Defaults to 0.75" ✗

Specific Issues

  1. AsymmetricFocalLoss (line 103, 111):

    • Code: gamma: float = 2
    • Docstring says: Defaults to 0.75
  2. AsymmetricUnifiedFocalLoss (line 162, 171):

    • Code: gamma: float = 0.5
    • Docstring says: Defaults to 0.75
  3. AsymmetricUnifiedFocalLoss also documents an epsilon parameter (line 172) that doesn't exist in the __init__ signature.

References

Suggested Fix

Update the docstrings to match the actual code defaults (which are correct per the original implementation).

I am happy to create a PR if this fix is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions