softmax 和 crossEntropyloss
pytorch 207
原文标题 :softmax and crossEntropyloss
我想知道softmax是否是多类(超过2个)分类神经网络中的必备品?我正在阅读一些堆栈溢出主题,我看到一些人说有必要在最后一层有 softmax,而另一些人说没有必要包含它,因为 crossEntropyloss 本身应用了 softmax,所以我不确定它是否真的有必要或不? (这里是讨论 pytorch 的链接 – 我需要在我的多类分类模型中应用 Softmax 函数吗? – 堆栈溢出!)据我所知,softmax 所做的只是将输出加权缩放到范围之间0 和 1,总和为 1。如果您能清除以下几点,我将不胜感激:
1. is it a must to have a softmax in the last layer in case of mutli-class classification?
2. if we have softmax in the last layer, would it affect the calculation of cross entropy loss?
3. if we don’t include it in the last layer, how would it affect the whole accuracy calculation and classification in general? thanks for your answers in advance.