Sentiment Classification
前言
如何利用RNN跟word embedding來進行Sentiment Classification的分析。
內容
Sentiment classification problem
- 給模型一些句子,模型會評估這個句子的情緒狀態分析(1~5顆星)。
- 通常我們下載別人已經訓練好的模型,其字典的單字數通常在100000個,而通常我們所要新訓練的句子,其字數通常約在10000左右,所以理論上都可以直接拿來使用了。
Simple sentiment classification model
- 首先,我們的目標是作1~5顆星的多分類的結果,所以使用了softmax。
- 將訓練句中的每個單字所對應的onehot encoding找出來。
- 然後結合Embedding Matrix做處理,產生有embedding vector。
- 找出每個單字的embedding vector(300 D)並不能幫我們分析句子,我們需要整體來看句子,所以需要將句子中的每個embedding vector加總起來求平均(300 D)。
- 缺點: "Completely lacking in good taste, good service, and good ambience"。以人為判斷,我們應該要讓這個句子只有一顆星,但以目前的模型設計,由於出現很多次正面的意義"good"的單字,可能導致模型會給這個句子多顆星星。
RNN for sentiment classification
- 利用RNN改善改善上述的缺點。
- RNN會記住"lacking",這個負面意義單字,然後看後面單字進行共同判斷,這樣就不會被後面的"goods"所迷惑了。
該學到的
- 如何根據word embedding建立基本sentiment classification model。
- RNN是如何解決sentiment classification model的缺點。