Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update F.multi_label_soft_margin_loss/nn.MultiLabelSoftMarginLoss docs 易用性提升 #7028

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Dec 21, 2024

PaddlePaddle/Paddle#70389
修复 MultiLabelSoftMarginLoss 公式以及删除 torch.nn.MultiLabelMarginLoss 的映射文档

Copy link

paddle-bot bot commented Dec 21, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7028.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@@ -11,7 +11,9 @@ MultiLabelSoftMarginLoss
损失函数按照下列公式计算

.. math::
\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.shape}(0)}
\text{loss}(input, label) = - \frac{1}{\text{C}} * \sum_i label[i] * \log((1 + \exp(-input[i]))^{-1}) + (1-label[i]) * \log\left(\frac{\exp(-input[i])}{(1 + \exp(-input[i]))}\right)
Copy link
Collaborator

Choose a reason for hiding this comment

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

是文档写成了MultiLabelMarginLoss,但是实现是MultiLabelSoftMarginLoss 对吧?MultiLabelSoftMarginLoss 没有问题吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的

@@ -1,44 +0,0 @@
## [ paddle 参数更多 ]torch.nn.MultiLabelMarginLoss
Copy link
Collaborator

Choose a reason for hiding this comment

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

在pytorch_api_mapping.md这个映射表里,将 MultiLabelMarginLoss 的映射改一下吧,应该是 功能缺失且较好实现 那一类

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

Copy link
Collaborator

Choose a reason for hiding this comment

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

在pytorch_api_mapping.md这个映射表里,将 MultiLabelMarginLoss 的映射改一下吧,应该是 功能缺失且较好实现 那一类

这个修改了吗

@zhwesky2010
Copy link
Collaborator

@NKNaN 上面这个修改了吗

@NKNaN
Copy link
Contributor Author

NKNaN commented Dec 26, 2024

@NKNaN 上面这个修改了吗

已修改

\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.shape}(0)}
\text{loss}(input, label) = - \frac{1}{\text{C}} * \sum_i label[i] * \log((1 + \exp(-input[i]))^{-1}) + (1-label[i]) * \log\left(\frac{\exp(-input[i])}{(1 + \exp(-input[i]))}\right)

其中 :math:`\text{C}` 为类别数量,

如果添加权重则再乘以对应的权重值
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两句话 感觉也不太通顺

\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.shape}(0)}
\text{loss}(input, label) = - \frac{1}{\text{C}} * \sum_i label[i] * \log((1 + \exp(-input[i]))^{-1}) + (1-label[i]) * \log\left(\frac{\exp(-input[i])}{(1 + \exp(-input[i]))}\right)

其中 :math:`\text{C}` 为类别数量,
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个后面是一个逗号吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改为句号,这一句是对上面公式的说明

\text{loss}(x, y) = \sum_{ij}\frac{\max(0, 1 - (x[y[j]] - x[i]))}{\text{x.shape}(0)}
\text{loss}(input, label) = - \frac{1}{\text{C}} * \sum_i label[i] * \log((1 + \exp(-input[i]))^{-1}) + (1-label[i]) * \log\left(\frac{\exp(-input[i])}{(1 + \exp(-input[i]))}\right)

其中 :math:`\text{C}` 为类别数量,
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改为句号,这一句是对上面公式的说明

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants