Skip to content

[Docathon][Update Doc No.29] fix the LossFunction #7227

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

Merged
merged 13 commits into from
Apr 17, 2025

Conversation

Echo-Nie
Copy link
Contributor

@Echo-Nie Echo-Nie commented Apr 4, 2025

Copy link

paddle-bot bot commented Apr 4, 2025

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

@Echo-Nie
Copy link
Contributor Author

Echo-Nie commented Apr 4, 2025

@DrRyanHuang pls review

Copy link
Collaborator

@DrRyanHuang DrRyanHuang left a comment

Choose a reason for hiding this comment

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

辛苦同学按照预览链接,修复一下 rst 文档的格式,删去与 fluid 相关的内容
http://preview-pr-7227.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/develop/api_guides/low_level/layers/loss_function.html

@@ -11,30 +11,30 @@ Paddle Fluid 中提供了面向多种任务的多种类型的损失函数,以
====

平方误差损失(squared error loss)使用预测值和真实值之间误差的平方作为样本损失,是回归问题中最为基本的损失函数。
API Reference 请参考 :ref:`cn_api_fluid_layers_square_error_cost`。
API Reference 请参考 :ref:`cn_api_nn_functional_square_error_cost`。
Copy link
Collaborator

Choose a reason for hiding this comment

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

辛苦同学以develop最新版为准修改一下,下同

Suggested change
API Reference 请参考 :ref:`cn_api_nn_functional_square_error_cost`。
API Reference 请参考 :ref:`cn_api_paddle_nn_functional_square_error_cost`。

@Echo-Nie Echo-Nie requested a review from DrRyanHuang April 16, 2025 02:12

* 序列分类(Sequence Classification)问题,整个序列对应一个预测标签,如文本分类。这种即是普通的分类问题,可以使用 cross entropy 作为损失函数。
* 序列片段分类(Segment Classification)问题,序列中的各个片段对应有自己的类别标签,如命名实体识别。对于这种序列标注问题,`(线性链)条件随机场(Conditional Random Field,CRF) <http://www.cs.columbia.edu/~mcollins/fb.pdf>`_ 是一种常用的模型方法,其使用句子级别的似然概率,序列中不同位置的标签不再是条件独立,能够有效解决标记偏置问题。Paddle Fluid 中提供了 CRF 对应损失函数的支持,API Reference 请参考 :ref:`cn_api_fluid_layers_linear_chain_crf`。
* 时序分类(Temporal Classification)问题,需要对未分割的序列进行标注,如语音识别。对于这种时序分类问题,`CTC(Connectionist Temporal Classification) <http://people.idsia.ch/~santiago/papers/icml2006.pdf>`_ 损失函数不需要对齐输入数据及标签,可以进行端到端的训练,Paddle Fluid 提供了 warpctc 的接口来计算相应的损失,API Reference 请参考 :ref:`cn_api_fluid_layers_warpctc`。
* 时序分类(Temporal Classification)问题,需要对未分割的序列进行标注,如语音识别。对于这种时序分类问题,`CTC(Connectionist Temporal Classification) <http://people.idsia.ch/~santiago/papers/icml2006.pdf>`_ 损失函数不需要对齐输入数据及标签,可以进行端到端的训练,Paddle Fluid 提供了 warpctc 的接口来计算相应的损失,API Reference 请参考 :ref:`cn_api_paddle_nn_functional_ctc_loss`。
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fluid 删一下

@Echo-Nie Echo-Nie requested a review from DrRyanHuang April 16, 2025 07:59
@@ -35,27 +35,26 @@ For large-scale classification problems, special methods and corresponding loss

* NCE solves the binary-classification problem of discriminating the true distribution and the noise distribution by converting the multi-classification problem into a classifier. The maximum likelihood estimation is performed based on the binary-classification to avoid calculating the normalization factor in the full-class space to reduce computational complexity.
* Hierarchical sigmoid realizes multi-classification by hierarchical classification of binary trees. The loss of each sample corresponds to the sum of the cross-entropy of the binary-classification for each node on the coding path, which avoids the calculation of the normalization factor and reduces the computational complexity.
The loss functions for both methods are available in Paddle Fluid. For API Reference please refer to :ref:`api_fluid_layers_nce` and :ref:`api_fluid_layers_hsigmoid`.
The loss functions for both methods are available in Paddle . For API Reference please refer to :ref:`api_paddle_static_nn_nce` and :ref:`api_paddle_nn_functional_hsigmoid_loss`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

同学看一下英文文档的 preview

这部分要加一个空行

Copy link
Collaborator

@DrRyanHuang DrRyanHuang left a comment

Choose a reason for hiding this comment

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

LGTM, 预览链接ZH EN

@DrRyanHuang DrRyanHuang merged commit 6e84439 into PaddlePaddle:develop Apr 17, 2025
2 checks passed
@Echo-Nie Echo-Nie deleted the No29 branch April 22, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants