对于softmax和sigmoid的理解

在分类问题中,人们常常会用到sigmoid和softmax这两个激活函数。

sigmoid:A logistic function or logistic curve is a common “S” shape (sigmoid curve).
也就是说,sigmoid把一个值映射到0-1之间。

softmax:softmax is a generalization of logistic function that “squashes”(maps) a K-dimensional vector z of arbitrary real values to a K-dimensional vector σ(z) of real values in the range (0, 1) that add up to 1.
softmax函数的本质就是将一个K维的任意实数向量压缩(映射)成另一个K维的实数向量,其中向量中的每个元素取值都介于(0,1)之间并且和为1。
softmax的形式如下:
这里写图片描述

总结一下,在二分类问题中,可以用softmax作为最后的激活层;在多分类单标签问题中,可以用sigmoid作为最后的激活层,取概率最高的作为结果;而在多标签问题中,又可以用多个softmax作为最后的激活层,想当于把每一个类别当作二分类来处理。

那什么一定要用softmax来处理多分类的问题呢?直接用归一化的方法不就好了。
这里面的原因有二:
这里写图片描述

关于对softmax相关的反向传播可以看这篇幅文章:
https://www.jianshu.com/p/ffa51250ba2e

猜你喜欢

转载自blog.csdn.net/weixin_42936560/article/details/81736674
今日推荐