Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

關於類神經網絡的輸入 #10

Open
ywchan2005 opened this issue Jun 13, 2016 · 0 comments
Open

關於類神經網絡的輸入 #10

ywchan2005 opened this issue Jun 13, 2016 · 0 comments

Comments

@ywchan2005
Copy link

英文版:Little things about data massage for neural network

調控

在設計類神經網絡時,有大約四處地方可供調控,從而令學習更有效。

  1. 輸入的數據
  2. 學習的預期輸出
  3. 網絡結構
  4. 網絡內的權重(weight)與偏權(bias)的初始化

對數據的調控

這次實驗集中處理對輸入數據及預期輸出的調控。要令反向傳播學習(backpropagation learning)更易達成,我們需要將輸入數據標準化(standardization),以及將預期輸出進行重新縮放(rescaling)。

x' = ( x - x.mean() ) / x.var()
y = ( y - y.min() ) / ( y.max() - y.min() )

輸入數據的標準化可以幫助穩定權重及偏權的調整,而預期輸出的數值應該遷就激勵函數(activation function)而作出調整。

實驗結果

以下是我們的類神經網絡要學習的數據。
1-fit-cosine
y = cos(x1) * cos(x2)
以下是我們的類神經網絡。

m = Sequential()
m.add( Dense( 16, input_dim=1, init='glorot_normal', activation='relu' ) )
m.add( Dense( 1, init='glorot_normal', activation='relu' ) )
m.compile( loss='mse', optimizer='adam' )

下圖是在訓練類神經網絡時所記錄的權重及偏權的調整和整體損失分數(total loss)。
2-fit-cosine
權重調整
3-fit-cosine
偏權調整
4-fit-cosine
整體損失分數
我們的類神經網絡在訓練後的輸出跟預期輸出相似。
5-fit-cosine
類神經網絡的輸出(綠);預期輸出(藍)
相反地,如果輸入數據沒有標準化,我們可以看出權重及偏權的調整比之前的不那麼平均,從而可能導致網絡中輸出神經元的飽和(saturation)。
6-fit-cosine
權重調整
7-fit-cosine
偏權調整
8-fit-cosine
整體損失分數
我們的類神經網絡在訓練後的輸出仍未能跟預期輸出相似。
9-fit-cosine
類神經網絡的輸出(綠);預期輸出(藍)

參考

  • LeCun, Yann A., et al. “Efficient backprop.” Neural networks: Tricks of the trade. Springer Berlin Heidelberg, 2012. 9–48.

關於筆者

VC,軟件工程師,閒餘學習類神經網絡
學習筆記記錄於 http://www.medium.com/vclab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant