How to?

3.0.1.损失函数

Oct 16, 2024
notesjulyfun技术学习d2l
1 Minutes
126 Words
This article was last updated on May 27, 2026 and some of the information may no longer be applicable due to the passage of time.

交叉熵损失 Cross Entropy Loss

Loss=−∑𝑛𝑖=1𝑦𝑖log𝑦𝑖∼

  • 𝑦𝑖 为真实分布,形如 [0,0,1,0]. 𝑦∼𝑖 为预测分布,形如 [0.1,0.1,0.6,0.2]

  • 独热编码情况下仅看正确标签的输出与 1 有多接近。每差 2 倍概率,损失 +1

  • batch 下乘以 1batch_size

  • 用于分类问题

  • 也可设计为将错误分类的交叉熵考虑进去

−∑𝑛𝑖=1(𝑦𝑖log𝑦𝑖∼+(1−𝑦𝑖)log(1−𝑦𝑖∼))

很好理解吧。

均方损失 MSELoss

(𝑥𝑖−𝑦𝑖)2

Article title:3.0.1.损失函数
Article author:Julyfun
Release time:Oct 16, 2024
Copyright 2026
Sitemap