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

【讀書1】【2017】MATLAB與深度學習——多元分類(1)

多元分類(Multiclass Classification)

本節介紹如何利用神經網路來處理三種或三種以上的分類。

This section introduces how to utilize theneural network to deal with the classification of three or more classes.

考慮將給定輸入資料的座標(x,y)劃分為三類(參見圖4-5)。

Consider a classification of the giveninputs of coordinates (x, y) into one of three classes (see Figure 4-5).

在這裡插入圖片描述
圖4-5 將資料劃分為三類Data with three classes

我們首先需要構造神經網路。

We need to construct the neural networkfirst.

我們將使用兩個節點作為輸入層,因為輸入由兩個引數組成。

We will use two nodes for the input layeras the input consists of two parameters.

為了簡單起見,這裡不考慮隱藏層。

For simplicity, the hidden layers are notconsidered at this time.

我們還需要確定輸出節點的數目。

We need to determine the number of theoutput nodes as well.

眾所周知,輸出節點數與類別數相匹配是最有前途的方法。

It is widely known that matching the numberof output nodes to the number of classes is the most promising method.

在這個例子中,我們使用三個輸出節點,因為這個問題需要將輸入資料分為三類。

In this example, we use three output nodes,as the problem requires three classes.

在這裡插入圖片描述
圖4-6示出了配置的神經網路。

Figure 4-6 illustrates the configuredneural network.

圖4-6 將輸入資料劃分為三類的神經網路配置圖Configured neuralnetwork for the three classes

一旦採用給定的資料訓練神經網路,我們就獲得了期望的多元分類器。

Once the neural network has been trainedwith the given data, we obtain the multiclass classifier that we want.

訓練資料在圖4-7中給出。

在這裡插入圖片描述

圖4-7 採用多元分類器訓練資料Training data withmulticlass classifier

對於圖中的每個資料點,前兩個數字分別是x和y座標,第三個值是對應的類別。

For each data point, the first two numbersare the x and y coordinates respectively, and the third value is thecorresponding class.

訓練資料包括輸入和正確輸出,因為該資料被用於監督學習。

The data includes the input and correctoutput as it is used for supervised learning.

為了計算誤差,我們將類別名轉換成數字程式碼,如同前一節中所做的那樣。

In order to calculate the error, we switchthe class names into numeric codes, as we did in the previous section.

考慮到我們的神經網路具有三個輸出節點,我們將類別與向量的對應關係對映如下:

Considering that we have three output nodesfrom the neural network, we create the classes as the following vectors:

在這裡插入圖片描述

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

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