31
Komachi Lab B4 宮崎亮輔 DL勉強会2014 Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.) 12/01 このスライド中の図の一部はこの論文中のものです

Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Embed Size (px)

Citation preview

Page 1: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

B4 宮崎亮輔

DL勉強会2014

Semantic Compositionality throughRecursive Matrix-Vector Spaces (Socher et al.)

12/01

※このスライド中の図の一部はこの論文中のものです

Page 2: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Agenda✤ MV-RNN Model!

✤ Back Propagation!

✤ Low-Rank Matrix Approximations!

✤ Experiments!

- Adverb-Adjective Pairs!

- Propositional Logic!

- Movie Review Ratings!

- Relation Classifications!

✤ Conclusion

2

Page 3: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

MV-RNN Model

3

Page 4: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Recursive Matrix-Vector Neural Network

✤ RNN (Recursive Neural Network)!

- 単語をベクトルで表現し, binary treeを構成するモデル!

✤ MV-RNN (Recursive Matrix-Vector Neural Network)!

- 単語をベクトルと行列で表現したRNN!

- word = (a, A) : aはn次元ベクトル, Aはn×n次元行列

4

Page 5: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Composition functions✤ 単語の合成もRNNと違う

5

RNNの合成関数:

MV-RNNの合成関数:

※) a, b, p ∈ Rn!

A, B, P ∈ Rn×n!

W, WM ∈ Rn×2ngは非線形関数(sigmoid, tanh)!g内にバイアス項も入れられるけど今回は簡単のために入れない

Page 6: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Motivation❖ ベクトルだけでは対称のテキストが!

- 単純な意味の合成ならうまく表現できるけど!

- オペレータとしての操作の場合はうまく表現できなかった!

- 副詞-形容詞ペア(e.g. unbelievably sad)とか

”not”と合成するときとか!

✤ ベクトルが意味を捉え, 行列が意味の変え方を捉える

6

Page 7: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Back Propagation

7

Page 8: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Back Propagation✤ 出力

8

✤ 誤差関数(Cross entropy)

✤ 誤差関数の最小化

タスクによって変わるが, 分類タスクなら多項分布にする

s: sentence, t: tree

L, LMは単語のベクトル,行列

Page 9: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Low-Rank Matrix Approximations

9

Page 10: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Low-Rank Matrix Approximations

✤ Back Propagationで学習するパラメータが多い

10

問題がある

W, WM: n×2n次元!Wlabel : d*n次元(dはラベル数)!

L : n次元×単語数!LM : n×n次元×単語数

➡ 行列の圧縮(低Rankの行列で近似)

一般的にn = 100くらい

Page 11: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Low-Rank Matrix Approximations✤ 方法は結構たくさんある(この辺はIIR最後にやる内容)!

- SVD(特異値分解)!

- CUR!

- CMD!

- NMF(非負値行列因子分解)!

✤ 今回使われてるのはNMF似ている方法

11

Page 12: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

NMF✤ NMF(非負値行列因子分解)

12

X UV

以下のように任意のRankのUとVに分解できる(X,U,Vはすべて非負)

X≈UV

以下のステップの繰り返しで近似する

Page 13: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Low-Rank Matrix Approximations✤ でも実際にやってるのは

13

diag(a): 対角成分がaの対角行列

U∈Rn×r, V∈Rr×n, a∈Rn

✤ これをすべての単語がもつ行列から置き換える!

✤ 今回はr = 3!

✤ 単語が持つ行列のパラメータ総数が

”|V|×n×n” から ”|V|×n×(2r+1)” に減った

Page 14: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Experiments

14

Page 15: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Experiments

✤ 複数のタスクにMV-RNNモデルを適応・実験!

- 副詞・形容詞ペアの感情分類!

- 命題論理の表現!

- Movie Reviewデータでの感情分類!

- 名詞間の関係分類

15

Page 16: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Sentiment Distributions of Adverb-Adjective Pairs

16

Page 17: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Adverb-Adjective Pairs✤ 全文ではなく副詞・形容詞ペアを合成した場合のみ!

✤ IMDB (Movie Review) データセットから連続するペアを抽出!

✤ ペアが出現したレビューの評価値(1~10)の分布を教師とする!

✤ 50回以上出現した4211ペアをtrain, 1804ペアをtestに!

- 単語のかぶりはあるが, ペアでのかぶりはない

17

Adverb Adjective

softmax

rating distribution

Page 18: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Adverb-Adjective Pairs✤ 既存手法との比較(様々な合成関数)

18

KLダイバージェンスで比べてる!

値が0になるほど正解分布と近い

p = Ab+Ba

RNN:

Linear MVR:

MV-RNN:

Page 19: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Adverb-Adjective Pairs

19

Page 20: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

1つ前のスライドで口頭で説明した内容

✤ 行は副詞が同じ(上からfairly, not, unbelievably)!

✤ 列は形容詞が同じ(左からannoying, awesome, sad)!

✤ notの行とかfairly awesomeで合成の表現に差がでてる!

✤ unbelievably sadはいい意味でも悪い意味でも使われるからU字になってる!

✤ (なんで正解分布は重ねなかったんだろう。。)

X

Page 21: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Logic-and Vector-based Compositionality

20

Page 22: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Propositional Logic

✤ andとかor, notのような命題論理を表現できるか!

✤ 論理式も再帰的な木構造で表現できるので同様にモデル化できる!

✤ 2値論理なので、ベクトルも行列も1次元!

- trueは(t=1, T=1), falseは(f=0, F=1)を正解とする

21

Page 23: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Propositional Logic

✤ 例えばnot falseのtreeでは誤差関数の最小化は

22

✤ 非線形関数の部分は閾値関数にする

Page 24: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Propositional Logic

✤ これを学習させると, ちゃんと再現した!

✤ つまりどの組み合わせで再帰的に組み合わされても表現できるということ

23

Page 25: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Predicting Movie Review Ratings

24

Page 26: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Predicting Movie Review Ratings

✤ 今度はレビュー文で評価値の推測をする!

✤ 10000文のpositiveとnegativeがあるデータセット

25

Page 27: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Predicting Movie Review Ratings

✤ 下2つはどの手法でも正解しなかった知識ベースが必要なケース

26

S: sentiment!C: MV-RNNだけ正解した

Page 28: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Classification of Semantic Relationship

27

Page 29: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Classification of Semantic Relationship

✤ COLING読み会で紹介した名詞間の関係を分類するタスク!

✤ 例えば!

- My [apartment] has a pretty large [kitchen].は!

- component-wholeの関係!

!

28

Page 30: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Classification of Semantic Relationship

❖ SVMでめちゃくちゃ素性エンジニアリングしたのには勝てなかった!

❖ ので、3つの素性をベクトルに入れた!

- POS (+0.9)!

- WN (+1.3)!

- NER(+0.6)

29

Page 31: Semantic Compositionality through Recursive Matrix-Vector Spaces (Socher et al.)

Komachi Lab

Conclusions✤ 完全な単語ベクトルの合成の扱いに向けて新しいモデルを導入した!

✤ 単語が他の単語の意味を変型させるモデル化をできた!

✤ 特に否定や副詞・形容詞などの接続に対しての表現がこれまで以上にできた!

✤ 様々なタスクにおいてモデルを一般化することができた!

✤ 様々なタスクでstate of the artを超えた

30