1. 程式人生 > >【讀書1】【2017】MATLAB與深度學習——多元分類(2)

【讀書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所示的格式顯示。

在這裡插入圖片描述
圖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》

更多精彩文章請關注微訊號:在這裡插入圖片描述