为什么要在CNN中使用softmax
数据挖掘
机器学习
深度学习
2021-10-02 12:15:34
1个回答
是的,你是对的。soft-max 层输出一个概率分布,即输出总和为 1 的值。sigmoid 函数输出边际概率,因此当类不互斥时可用于多类分类。此外,soft-max 层是最大输出层的软版本,因此它是可微的,并且对异常值也有弹性。sigmoid 的一个问题是当你达到饱和(值接近 1 或 0)时,梯度消失。这对优化速度不利,soft-max 没有这个问题。另一种解释是 soft-max 作为 sigmoid 的泛化,实际上当有两个类时它们是相同的。
最后,当类互斥时,您应该使用 soft-max,而当类相互独立时,您应该使用 sigmoid。这可以总结在下表中:
Soft-Max | Sigmoid
-------------------------------------------------------------------------
Used for multi-classification | Used for binary classification in
in logistic regression model. | logistic regression model.
-------------------------------------------------------------------------
The probabilities sum will be 1 | The probabilities sum need not be 1
-------------------------------------------------------------------------
Used in the different layers of | Used as activation function while
neural networks. | building neural networks
-------------------------------------------------------------------------
The high value will have the higher | The high value will have the high
probability than other values. | probability but not the higher
有关 soft-max 的更多信息,请查看以下链接:1、2和3。有关分步指南,包括 Python 中的用法,请参阅此参考4。
有关 soft-max 与 sigmoid 的更多信息,请查看:5、6和7。
如果您想要更可靠的来源来了解为什么对互斥类使用 soft-max 回归,您可以查看此处。此页面是斯坦福大学无监督特征学习和深度学习教程的一部分,它包含由 Andrew Ng 和其他人提供的材料。
其它你可能感兴趣的问题