【读书1】【2017】MATLAB与深度学习——多元分类(2)

这种转换意味着每个输出节点都映射到向量中的一个元素,只有该元素对应的节点产生1。

This transformation implies that eachoutput node is mapped to an element of the class vector, which only yields 1for the corresponding node.

例如,如果数据属于第2类,则仅有第二节点的输出为1,而其它节点为0(参见图4-8)。

For example, if the data belongs to Class2, the output only yields 1 for the second node and 0 for the others (seeFigure 4-8).

在这里插入图片描述
图4-8 每个输出节点都被映射到类向量中的元素Each output nodeis now mapped to an element of the class vector

这种表示方法被称为1元热键编码或N取1编码。

This expression technique is called one-hotencoding or 1-of-N encoding.

我们将输出节点数目与类别数目相匹配的原因正是为了应用此编码技术。

The reason that we match the number ofoutput nodes to the number of classes is to apply this encoding technique.

Now, the training data is displayed in theformat shown in Figure 4-9.

现在,训练数据以图4-9所示的格式显示。

扫描二维码关注公众号,回复: 3885269 查看本文章

在这里插入图片描述
图4-9 训练数据以新格式显示Training data is displayedin a new format

接下来,应该定义输出节点的激活函数。

Next, the activation function of the outputnode should be defined.

由于转换后的训练数据的正确输出范围是从0到1,我们能否像二元分类那样使用sigmoid函数?

Since the correct outputs of the transformedtraining data range from zero to one, can we just use the sigmoid function aswe did for the binary classification?

一般来说,多元分类器采用softmax函数作为输出节点的激活函数。

In general, multiclass classifiers employthe softmax function as the activation function of the output node.

到目前为止,我们讨论的激活函数,包括sigmoid函数,只考虑输入数据的加权和。

The activation functions that we havediscussed so far, including the sigmoid function, account only for the weightedsum of inputs.

它们没有考虑其它输出节点的输出。

They do not consider the output from theother output nodes.

然而,softmax函数不仅考虑了输入数据的加权和,还考虑了其它输出节点的输入。

However, the softmax function accounts notonly for the weighted sum of the inputs, but also for the inputs to the otheroutput nodes.

例如,当三个输出节点的输入加权和分别为2、1和0.1时,softmax函数的计算如图4-10所示。

For example, when the weighted sum of theinputs for the three output nodes are 2, 1, and 0.1, respectively, the softmaxfunction calculates the outputs shown in Figure 4-10.

在这里插入图片描述
图4-10 Softmax函数计算Softmax function calculations

在分母中需要用到输入的所有加权和。

All of the weighted sums of the inputs arerequired in the denominator.

为什么我们坚持使用softmax函数?

Why do we insist on using the softmaxfunction?

考虑用sigmoid函数代替softmax函数。

Consider the sigmoid function in place ofthe softmax function.

——本文译自Phil Kim所著的《Matlab Deep Learning》

更多精彩文章请关注微信号:在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42825609/article/details/83536499