Skip to content

Commit 2147c11

Browse files
ytl0623ericspod
andauthored
Update the docstrings to match the actual code defaults (#8701)
Fixes #8689 ### Description Update the docstrings to match the actual code defaults. 1. AsymmetricFocalLoss (line 103, 111): `gamma` 2. AsymmetricUnifiedFocalLoss (line 162, 171): `gamma` 3. AsymmetricUnifiedFocalLoss (line 172): `epsilon` ### 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: ytl0623 <david89062388@gmail.com> Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 1149b50 commit 2147c11

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

monai/losses/unified_focal_loss.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(
4444
Args:
4545
to_onehot_y: whether to convert `y` into the one-hot format. Defaults to False.
4646
delta : weight of the background. Defaults to 0.7.
47-
gamma : value of the exponent gamma in the definition of the Focal loss . Defaults to 0.75.
47+
gamma : value of the exponent gamma in the definition of the Focal loss. Defaults to 0.75.
4848
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
4949
"""
5050
super().__init__(reduction=LossReduction(reduction).value)
@@ -108,7 +108,7 @@ def __init__(
108108
Args:
109109
to_onehot_y : whether to convert `y` into the one-hot format. Defaults to False.
110110
delta : weight of the background. Defaults to 0.7.
111-
gamma : value of the exponent gamma in the definition of the Focal loss . Defaults to 0.75.
111+
gamma : value of the exponent gamma in the definition of the Focal loss. Defaults to 2.
112112
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
113113
"""
114114
super().__init__(reduction=LossReduction(reduction).value)
@@ -167,10 +167,11 @@ def __init__(
167167
Args:
168168
to_onehot_y : whether to convert `y` into the one-hot format. Defaults to False.
169169
num_classes : number of classes, it only supports 2 now. Defaults to 2.
170+
weight : weight for each loss function. Defaults to 0.5.
171+
gamma : value of the exponent gamma in the definition of the Focal loss. Defaults to 0.5.
170172
delta : weight of the background. Defaults to 0.7.
171-
gamma : value of the exponent gamma in the definition of the Focal loss. Defaults to 0.75.
172-
epsilon : it defines a very small number each time. similarly smooth value. Defaults to 1e-7.
173-
weight : weight for each loss function, if it's none it's 0.5. Defaults to None.
173+
174+
174175
175176
Example:
176177
>>> import torch

0 commit comments

Comments
 (0)