LSTM特點及適用性

ProClaim:

之前一直在做CNN的一些研究,最近剛剛回到實驗室,定下來了自己的小組,然後開始了一些LSTM的學習。


將近學習了兩天半吧,結構弄得差不多了,Theano上LSTM tutorial 的例程也跑了跑,正在讀代碼ing。


這篇博客主要是我之後要做的一個小報告的梗概,梳理了一下LSTM的特點和適用性問題。


發在這裏權當做開博客壓壓驚。


希望之後能跟各位朋友多多交流,共同進步。


1. 概念:

Long short-termmemory (LSTM)is a recurrent neuralnetwork (RNN)architecture (an artificialneural network)published[1] in 1997 by Sepp Hochreiter and Jürgen Schmidhuber. Like most RNNs, an LSTM network is universalin the sense that given enough network units it can compute anything aconventional computer can compute, provided it has the proper weight matrix, which may be viewed as its program. Unliketraditional RNNs, an LSTM network is well-suited to learn from experience to classifyprocess and predict time series when there are very long time lags of unknownsize between important events. This is one of the main reasons why LSTMoutperforms alternative RNNs and Hidden Markov Models and other sequence learning methods in numerousapplications.

 

2.類屬


 

 

LSTM是RNN的一種變種,屬於反饋神經網絡的範疇。

 

3.模型的特點與適用性

3.1 前饋神經網絡VS 反饋神經網絡

在深度學習領域,傳統的前饋神經網絡(feed-forward neural net,簡稱FNN)具有出色的表現,取得了許多成功,它曾在許多不同的任務上——包括手寫數字識別和目標分類上創造了記錄。甚至到了今天,FNN在解決分類任務上始終都比其他方法要略勝一籌。

儘管如此,大多數專家還是會達成共識:FNN可以實現的功能仍然相當有限。究其原因,人類的大腦有着驚人的計算功能,而分類任務僅僅是其中很小的一個組成部分。我們不僅能夠識別個體案例,更能分析輸入信息之間的整體邏輯序列。這些信息序列富含有大量的內容,信息彼此間有着複雜的時間關聯性,並且信息長度各種各樣。例如視覺、開車、演講還有理解能力,這些都需要我們同時處理高維度的多種輸入信息,因爲它們時時都在變化,而這是FNN在建模時就極爲匱乏的。

 

3.2 CNN vs RNN

《Convolutional Networks for Images, Speech,and Time Series》,by YannLeCun & Yoshua Bengio

http://nuyoo.utm.mx/~jjf/rna/A12%20Convolutional%20networks%20for%20images,%20speech,%20and%20time%20series.pdf
尤其是這一段:
While characters or short spoken words can besize-normalized and fed to a fixed-size network, more complex objects such aswritten or spoken words and sentences have inherently variable size. One way ofhandling such a composite object is to segment it heuristically into simplerobjects that can be recognized individually, e.g. characters phonemes. However,reliable segmentation heuristics do not exist for speech or cursivehandwriting. A bruteforce solution.....

簡單的說,CNN並不完全適用於學習時間序列,因此會需要各種輔助性處理,且效果也不一定好。面對對時間序列敏感的問題赫和任務,RNN(LSTM)通常會比較合適。

 

 

一個例子:

Task 1 - Sentiment analysis: You're given some review, and youwant to predict the rating of the review. 
Task 2 - Machine translation: Translate a sentence from some source language totarget language.

Now, the basic difference in terms of applicability of conv-net and RNN is thatconv-nets (like most other machine learning algorithm) take a fixed size inputand generate fixed-size outputs. RNN, on the other hand, can handle arbitraryinput/output lengths, but would typically require much more data compared toconv-nets because it is a more complex model.

Using this insight, we see that task 2 cannot be performed by conv-nets, sinceinputs and outputs are not fixed-length. So RNNs for task 2.


For task 1, however, you can use RNN if you have a lot of data. But you canalso use conv-nets - fix the length of the input, and adjust the input lengthby truncating or padding the actual input. Note that this will not affect thesentiment of the review much, so this is a reasonable approach. And since it'sa 1D convolution, that is typically used in sequences, it is called temporalconvolution. Conceptually, it is similar to 2D spatial convolution.

小結:

RNN迴歸型網絡,用於序列數據,並且有了一定的記憶效應,輔之以lstm
CNN
應該側重空間映射,圖像數據尤爲貼合此場景。

 

3.3 LSTM vs (傳統)RNNs

兩篇文章的描述:

 

1.     AlexGraves. 《SupervisedSequence Labelling with Recurrent Neural Networks》. Textbook, Studies inComputational Intelligence, Springer, 2012.

 

“Long Short-term Memory (LSTM) is an RNN architecture designed to be better at storing and accessing information thanstandard RNNs. LSTM has recently given state-of-the-art results in a variety ofsequenceprocessing tasks, including speech andhandwriting recognition .”

 

 

2.    Yann LeCunYoshua BengioGeoffrey Hinton合作的這篇綜述文章《Deep Learning

 

RNNs一旦展開(如圖5),可以將之視爲一個所有層共享同樣權值的深度前饋神經網絡。雖然它們的目的是學習長期的依賴性,但理論的和經驗的證據表明很難學習並長期保存信息。

爲了解決這個問題,一個增大網絡存儲的想法隨之產生。採用了特殊隱式單元的LSTMlong short-termmemory networks)被首先提出,其自然行爲便是長期的保存輸入。一種稱作記憶細胞的特殊單元類似累加器和門控神經元:它在下一個時間步長將擁有一個權值並聯接到自身,拷貝自身狀態的真實值和累積的外部信號,但這種自聯接是由另一個單元學習並決定何時清除記憶內容的乘法門控制的。

LSTM網絡隨後被證明比傳統的RNNs更加有效,尤其當每一個時間步長內有若干層時,整個語音識別系統能夠完全一致的將聲學轉錄爲字符序列。目前LSTM網絡或者相關的門控單元同樣用於編碼和解碼網絡,並且在機器翻譯中表現良好。”

 

4.在不同任務上的數據對比

Task

classification

sentiment analysis

machine translation

dialog

language generation

QA

total

2006年以來,從Google Scholar上的檢索數據進行對比

LSTM

1900

148

616

373

27

59

3690

CNN

5060

179

247

304

30

100

5670

Web of Science數據庫上的主題檢索進行對比(全時間)

LSTM

56

0

1

0

6

2

248

CNN

373

2

13

0

25

2

1064

 

數據儘管在檢索上還有一些問題,尤其是 WOS數據庫上涵蓋的文章可能代表了一部分水平比較高的論文,在數量上並不完全按與研究的力度劃等號,但還是可以看出一些端倪。

CNN大部分的任務都是跟分類相關的,在處理一些較爲複雜的任務上的應用暫時還比較匱乏。而LSTM在近年來尤其發展迅猛,在處理序列相關的任務時的應用較爲廣泛。


5.結論

LSTM是RNN的一個優秀的變種模型,繼承了大部分RNN模型的特性,同時解決了梯度反傳過程由於逐步縮減而產生的Vanishing Gradient問題。具體到語言處理任務中,LSTM非常適合用於處理與時間序列高度相關的問題,例如機器翻譯、對話生成、編碼\解碼等。

雖然在分類問題上,至今看來以CNN爲代表的前饋網絡依然有着性能的優勢,但是LSTM在長遠的更爲複雜的任務上的潛力是CNN無法媲美的。它更真實地表徵或模擬了人類行爲、邏輯發展和神經組織的認知過程。尤其從2014年以來,LSTM已經成爲RNN甚至深度學習框架中非常熱點的研究模型,得到大量的關注和研究。


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章