知识卡片
对数概率与负对数损失符号相反
LogSoftmax返回log p,通常不大于0,对它取exp得到模型类别概率。NLLLoss对正确类取−log p而为非负;表中负值称log_loss容易混淆,只有确认存的是log p才可直接exp还原。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Perhaps, the most important piece of an AI algorithm is the metric you used to train it. In listing 8.8, you used NLLLoss for the PyTorch optimization training loop, where NLL stands for negative log likelihood. You should already know how to invert the log() part of that expression. Try to guess what the mathematical function and Python code is to invert the log() function
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第08章《循环网络与长短期记忆》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-8.html)
- 结论依据:摘录中关于对数概率与负对数损失符号相反的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Perhaps, the most important piece of an AI algorithm is the metric you used to train it. In listing 8.8, you used NLLLoss for the PyTorch optimization training loop, where NLL stands for negative log likelihood. You should already know how to invert the log() part of that expression. Try to guess what the mathematical function and Python code is to invert the log() function