Neural Network's (NN) Backward Propagation
Outline
- Introduction
- Architecture
- Forward propagation(FP)
- Backward propagation(BP)
- Summary
Introduction
-
NN內部的神經元是基於linear logistic regression(sigmoid)組合的non-linear logistic function。為什麼每個神經元不直接採用non-linear logistic regression(polymomial regression)來組成呢? non-linear logistic logistic的問題是
1.1 non-linear logistic regression必須自己設計特徵值個數的多項式組合
1.2 設計完整特徵值個數太多。如果有N個特徵值,一個完整的多項式項數(特徵值)可以達到 \(H_N^N\)個,假設samples數是M,且採用Batch Gradient Descent,計算複雜度太大會達到\(O(H_N^N*M)\)

-
Lost Function使用Cross Entropy Loss,而非least square的好處[1]
2.1 Sigmoid是non-convex function(有convex和concave),做square之後還是一樣non-convex,因此如果做gradient descent,不一定能得到global minimum[1]。
2.2 gradient求解效率問題。由Sigmoid圖形可知,在超過定值後,gradient會趨於平緩,求解效率變低
Architecture

- 做FP和BP是為了加速求解batch gradient descent \(\theta = \theta - \lambda\dfrac{\partial J(\theta)}{\partial \theta}\)中的\(\dfrac{\partial J(\theta)}{\partial \theta}\)
- Cost Function

Forward propagation
\((a^{(1)}, y)\)是一組sample,給定初始任意值\(\theta\), 需計算出對應\(a^{(2)}, a^{(3)}\), 其中


Backward propagation
-
推導\(\dfrac{\partial J(\theta)}{\partial \theta^{(2)}}\),紅色標記代表\(\delta^{(3)}\)

由上面推導可知,只要先求出\(\delta^{(3)}\),即可求出\(\dfrac{\partial J(\theta)}{\partial \theta^{(2)}}\) -
推導\(\dfrac{\partial J(\theta)}{\partial \theta^{(1)}}\),紅色標記代表\(\delta^{(3)}\),藍色標記代表\(\delta^{(2)}\)

由上面推導可知,只要求解\(\delta^{(2)}\),即可算出\(\dfrac{\partial J(\theta)}{\partial \theta^{(1)}}\). 但是\(\delta^{(2)}\)是由\(\delta^{(3)}\)組成,因此必須先求出\(\delta^{(3)}\). 這個由後往前先算出全部\(\delta\)的過程被稱為BP. -
以下是步驟2中\(\dfrac{\partial J(\theta)}{\partial \theta^{(1)}_{11}}\)的相關參數關聯性示意圖

Summary
PS:
上面舉的例子是一個sample的推導,如果sample數量是m,cost function會累加m次

因此,\(\dfrac{\partial J(\theta)}{\partial \theta^{(2)}}\)和\(\dfrac{\partial J(\theta)}{\partial \theta^{(1)}}\)也會累加m次後才計算一次\(\theta = \theta - \lambda\dfrac{\partial J(\theta)}{\partial \theta}\)
References
[1]https://optimization.mccormick.northwestern.edu/index.php/Signomial_problems
[2]Professor Andrew Ng Neural Network https://www.youtube.com/watch?v=b0mv1sJvRp0

