SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
word2vec + 𝛼
mt_caret
kml輪講
2018-05-25
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 1 / 28
全体の流れ
自然言語処理に関して何も知らないところからword2vecの仕組みとその後の発展ま
でを追う。
Linguistic Regularities in Continuous Space Word Representations
Efficient Estimation of Word Representations in Vector Space
Distributed Representations of Words and Phrases and their
Compositionality
(word2vec Parameter Learning Explained)
(word2vec Explained: Deriving Mikolov et al’s Negative Sampling
Word-Embedding Method)
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 2 / 28
語の表現方法
図 1: One-hotベクトル (https://blog.acolyer.orgより引用)
𝑦𝑦𝑦 = 𝑓(𝑊𝑊𝑊𝑥𝑥𝑥)のようなモデルを考えた時、 𝑥𝑥𝑥が語に対応する One-hotベクトルだと
考えると 𝑊𝑊𝑊𝑥𝑥𝑥は 𝑊𝑊𝑊の一列を取り出していると考えることができる。したがっ
て、 𝑊𝑊𝑊の各列は語に対応していると解釈できる。
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 3 / 28
語の表現方法
すると、語のOne-hotベクトルを入力とするニューラルネットワークベースのモデ
ルであれば、最初の層の重み 𝑊𝑊𝑊の各列から語を表す連続的なベクトル、つまり分散
表現が得られる。
図 2: 分散表現 (https://blog.acolyer.orgより引用)
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 4 / 28
Linguistic Regularities in Continuous Space Word
Representations
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 5 / 28
Linguistic Regularities in Continuous Space Word
Representations
これらの分散表現は言語における統語構造・意味構造が上手く反映されている。
統語構造: apple − apples ≃ car − cars
意味構造: woman − man ≃ queen − king
図 3: 分散表現 (https://blog.acolyer.orgより引用)
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 6 / 28
Linguistic Regularities in Continuous Space Word
Representations
統語構造・意味構造の検証のためのテストセットを用意し 𝑎 ∶ 𝑏, 𝑐 ∶ 𝑑という関係性
において 𝑑を求めたい語とした時、 𝑏 − 𝑎 + 𝑐にコサイン距離が最も近い語を答えと
し、正答率を検証。
図 4: 統語構造のテストセット
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 7 / 28
Linguistic Regularities in Continuous Space Word
Representations
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 8 / 28
Efficient Estimation of Word Representations in Vector
Space
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 9 / 28
Efficient Estimation of Word Representations in Vector
Space
𝑂 = 𝐸 × 𝑇 × 𝑄
O: 学習に掛かる計算量
E: データセットの大きさ(語数)
Q: モデル依存
NNベースのモデル(NNLM)
𝑄 = 𝑁 × 𝐷 + 𝑁 × 𝐷 × 𝐻 + 𝐻 × 𝑉
N: 入力語数
D: 投影先の次元
H: 分散表現の次元
V: Vocabularyの大きさ
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 10 / 28
Efficient Estimation of Word Representations in Vector
Space
𝑂 = 𝐸 × 𝑇 × 𝑄
O: 学習に掛かる計算量
E: データセットの大きさ(語数)
Q: モデル依存
RNNベースのモデル(RNNLM)
𝑄 = 𝐻 × 𝐻 + 𝐻 × 𝑉
H: 分散表現の次元
V: Vocabularyの大きさ
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 11 / 28
Efficient Estimation of Word Representations in Vector
Space
図 5: Continuous Bag-of-Words(CBOW)とContinuous Skip-gramモデル
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 12 / 28
word2vec Parameter Learning Explained
ℎℎℎ = 𝑥𝑥𝑥 𝑇
𝑊𝑊𝑊
図 6: 1語入力のCBOWモデル
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 13 / 28
word2vec Parameter Learning Explained
ℎℎℎ =
1
𝐶
𝑊𝑊𝑊 (𝑥𝑥𝑥1 + 𝑥𝑥𝑥2 + ⋯ + 𝑥𝑥𝑥 𝐶)
図 7: 多語入力のCBOWモデル
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 14 / 28
word2vec Parameter Learning Explained
モデルの構造は1語入力のCBOWと同じだが、出力 𝑦をコンテキストの語全てと比較
して交差エントロピーロスを計算する。
図 8: Skip-gramモデル
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 15 / 28
word2vec Parameter Learning Explained
Hierarchical Softmax
通常のSoftmaxだと分母で出力列ベクトルの全ての行を計算する必要があり、
𝐻 × 𝑉 の計算が必要になっていた。そこで、各語を表す行に行き着く確率を二分木
と各枝での左右への遷移確率をシグモイドでモデル化する。すると、各枝では
𝐻 × 1の計算で済みlog2(𝑉 )回の遷移で語にたどり着くため 𝐻 × 𝑉 が
𝐻 × log2(𝑉 )になる。
𝑃(”time”|𝐶) = 𝑃 𝑛0
(right|𝐶)𝑃 𝑛1
(left|𝐶)𝑃 𝑛2
(right|𝐶)
図 9: Hierarchical Softmaxの図 (http://building-babylon.net/より引用)
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 16 / 28
Efficient Estimation of Word Representations in Vector
Space
𝑂 = 𝐸 × 𝑇 × 𝑄
O: 学習に掛かる計算量
E: データセットの大きさ(語数)
Q: モデル依存
Continuous Bag-of-Wordsモデル(CBOW)
𝑄 = 𝐶 × 𝐷 + 𝐷 × 𝑙𝑜𝑔2(𝑉 )
C: 入力語数
D: 投影先の次元かつ分散表現の次元(同一)
V: Vocabularyの大きさ
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 17 / 28
Efficient Estimation of Word Representations in Vector
Space
𝑂 = 𝐸 × 𝑇 × 𝑄
O: 学習に掛かる計算量
E: データセットの大きさ(語数)
Q: モデル依存
Continuous Skip-gramモデル(CBOW)
𝑄 = 𝐶 × (𝐷 + 𝐷 × 𝑙𝑜𝑔2(𝑉 ))
C: 予測する語数
D: 投影先の次元かつ分散表現の次元(同一)
V: Vocabularyの大きさ
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 18 / 28
Efficient Estimation of Word Representations in Vector
Space
We observe large improvements in accuracy at much lower computa-
tional cost, i.e. it takes less than a day to learn high quality word
vectors from a 1.6 billion words data set. Furthermore, we show that
these vectors provide state-of-the-art performance on our test set
for measuring syntactic and semantic word similarities.
図 10: CBOWとSkip-gramの結果
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 19 / 28
Efficient Estimation of Word Representations in Vector
Space
We observe large improvements in accuracy at much lower computa-
tional cost, i.e. it takes less than a day to learn high quality word
vectors from a 1.6 billion words data set. Furthermore, we show that
these vectors provide state-of-the-art performance on our test set
for measuring syntactic and semantic word similarities.
図 11: 計算時間
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 20 / 28
Efficient Estimation of Word Representations in Vector
Space
The training speed is significantly higher than reported earlier in this
paper, i.e. it is in the order of billions of words per hour for typical
hyperparameter choices. We also published more than 1.4 million vec-
tors that represent named entities, trained on more than 100 billion
words. Some of our follow-up work will be published in an upcoming
NIPS 2013 paper.
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 21 / 28
Distributed Representations of Words and Phrases and their
Compositionality
Negative Sampling
Subsampling
Learning Phrases
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 22 / 28
word2vec Parameter Learning Explained
Negative Sampling
そもそもSoftmaxを使わずNoise Contrastive Estimation(NCE)の近似である
Negative Sampling(NEG)を行う。具体的には正解の語を最大化し、データセットか
ら 𝑘個語を引いてそれらを最小化することを目標として学習する。
log 𝜎 (𝑣′
𝑤 𝑂
𝑣 𝑇
𝑤 𝐼
) +
𝑘
∑
=1
𝔼 𝑤 𝑖∼𝑃 𝑛(𝑤)[− log 𝜎 (𝑣′
𝑤 𝑖
𝑣 𝑇
𝑤 𝐼
)]
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 23 / 28
Distributed Representations of Words and Phrases and their
Compositionality
Subsampling
頻出語(“in”, “the”, “a”, etc.のストップワード等)は情報が少ないため、確率
𝑃(𝑤 𝑖) = 1 − √
𝑡
𝑓(𝑤 𝑖)
の確率で語を捨てる処理をコーパスについて行った後にword2vecの学習を行う。こ
この 𝑡は適当に決める(10−5
前後が典型的)。
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 24 / 28
Distributed Representations of Words and Phrases and their
Compositionality
Learning for Phrases
単体で出現する確率(unigram)と2語連続して出現する確率(bigram)を用いて以下の
スコアを計算し、閾値を超えたものは新しい語としてVocabularyに追加する。これ
を閾値を下げながら何パスか行う。
score(𝑤 𝑖, 𝑤 𝑗) =
count(𝑤 𝑖, 𝑤 𝑗) − 𝛿
count(𝑤 𝑖) × count(𝑤 𝑗)
図 12: 句を学習した結果
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 25 / 28
Distributed Representations of Words and Phrases and their
Compositionality
この論文の成果がオープンソースとしてhttps://code.google.com/p/word2vecで
公開されていて、そのプロジェクトの名前がword2vec1
。
1
タイトル回収
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 26 / 28
+𝛼
Hierarchical Softmaxの木の作り方 (A Scalable Hierarchical Distributed
Language Model)
Poincare Embeddings (Poincaré Embeddings for Learning Hierarchical
Representations)
doc2vec (Distributed Representations of Sentences and Documents)
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 27 / 28
参考にした資料
The amazing power of word vectors | the morning paper
Hierarchical Softmax – Building Babylon
How does sub-sampling of frequent words work in the context of
Word2Vec? - Quora
Approximating the Softmax for Learning Word Embeddings
A gentle introduction to Doc2Vec – ScaleAbout – Medium
異空間への埋め込み!Poincare Embeddingsが拓く表現学習の新展開 - ABEJA
Arts Blog
Neural Network Methods for Natural Language Processing
mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 28 / 28

Contenu connexe

Tendances

Knowledge_graph_alignment_with_entity-pair_embedding
Knowledge_graph_alignment_with_entity-pair_embeddingKnowledge_graph_alignment_with_entity-pair_embedding
Knowledge_graph_alignment_with_entity-pair_embeddingAce12358
 
STAIR Lab Seminar 202105
STAIR Lab Seminar 202105STAIR Lab Seminar 202105
STAIR Lab Seminar 202105Sho Takase
 
深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習Masahiro Suzuki
 
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...禎晃 山崎
 
(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick
(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick
(DL hacks輪読) Variational Dropout and the Local Reparameterization TrickMasahiro Suzuki
 
Connecting embedding for knowledge graph entity typing
Connecting embedding for knowledge graph entity typingConnecting embedding for knowledge graph entity typing
Connecting embedding for knowledge graph entity typing禎晃 山崎
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習Deep Learning JP
 
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...Kazutoshi Shinoda
 
トピックモデル
トピックモデルトピックモデル
トピックモデル貴之 八木
 
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノートWataru Shito
 
[DL輪読会]It's not just size that maters small language models are also few sho...
[DL輪読会]It's not just size that maters  small language models are also few sho...[DL輪読会]It's not just size that maters  small language models are also few sho...
[DL輪読会]It's not just size that maters small language models are also few sho...Deep Learning JP
 
Towards neural network-based reasoning 文献講読
Towards neural network-based reasoning 文献講読Towards neural network-based reasoning 文献講読
Towards neural network-based reasoning 文献講読poppyuri
 
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライドWataru Shito
 
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...Deep Learning JP
 
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence ModelingDeep Learning JP
 
ノンパラメトリックベイズを用いた逆強化学習
ノンパラメトリックベイズを用いた逆強化学習ノンパラメトリックベイズを用いた逆強化学習
ノンパラメトリックベイズを用いた逆強化学習Shota Ishikawa
 

Tendances (17)

Knowledge_graph_alignment_with_entity-pair_embedding
Knowledge_graph_alignment_with_entity-pair_embeddingKnowledge_graph_alignment_with_entity-pair_embedding
Knowledge_graph_alignment_with_entity-pair_embedding
 
STAIR Lab Seminar 202105
STAIR Lab Seminar 202105STAIR Lab Seminar 202105
STAIR Lab Seminar 202105
 
深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習深層生成モデルを用いたマルチモーダル学習
深層生成モデルを用いたマルチモーダル学習
 
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...
CluBERT: A Cluster-Based Approach for Learning Sense Distributions in Multipl...
 
Extract and edit
Extract and editExtract and edit
Extract and edit
 
(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick
(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick
(DL hacks輪読) Variational Dropout and the Local Reparameterization Trick
 
Connecting embedding for knowledge graph entity typing
Connecting embedding for knowledge graph entity typingConnecting embedding for knowledge graph entity typing
Connecting embedding for knowledge graph entity typing
 
[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習[DL輪読会]相互情報量最大化による表現学習
[DL輪読会]相互情報量最大化による表現学習
 
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...
[PaperReading]Unsupervised Discrete Sentence Representation Learning for Inte...
 
トピックモデル
トピックモデルトピックモデル
トピックモデル
 
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
 
[DL輪読会]It's not just size that maters small language models are also few sho...
[DL輪読会]It's not just size that maters  small language models are also few sho...[DL輪読会]It's not just size that maters  small language models are also few sho...
[DL輪読会]It's not just size that maters small language models are also few sho...
 
Towards neural network-based reasoning 文献講読
Towards neural network-based reasoning 文献講読Towards neural network-based reasoning 文献講読
Towards neural network-based reasoning 文献講読
 
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
 
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...
[DL輪読会]Life-Long Disentangled Representation Learning with Cross-Domain Laten...
 
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling
[DL輪読会]Decision Transformer: Reinforcement Learning via Sequence Modeling
 
ノンパラメトリックベイズを用いた逆強化学習
ノンパラメトリックベイズを用いた逆強化学習ノンパラメトリックベイズを用いた逆強化学習
ノンパラメトリックベイズを用いた逆強化学習
 

Similaire à Word2vec alpha

【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks? 【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks? Deep Learning JP
 
単語・句の分散表現の学習
単語・句の分散表現の学習単語・句の分散表現の学習
単語・句の分散表現の学習Naoaki Okazaki
 
単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展Naoaki Okazaki
 
パターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvqパターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvqsleipnir002
 
Neural word embedding as implicit matrix factorization の論文紹介
Neural word embedding as implicit matrix factorization の論文紹介Neural word embedding as implicit matrix factorization の論文紹介
Neural word embedding as implicit matrix factorization の論文紹介Masanao Ochi
 
Transformer メタサーベイ
Transformer メタサーベイTransformer メタサーベイ
Transformer メタサーベイcvpaper. challenge
 
GPU上でのNLP向け深層学習の実装について
GPU上でのNLP向け深層学習の実装についてGPU上でのNLP向け深層学習の実装について
GPU上でのNLP向け深層学習の実装についてYuya Unno
 
Chainerの使い方と 自然言語処理への応用
Chainerの使い方と自然言語処理への応用Chainerの使い方と自然言語処理への応用
Chainerの使い方と 自然言語処理への応用Yuya Unno
 
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介Masayoshi Kondo
 
静的型付け言語 Crystal
静的型付け言語 Crystal静的型付け言語 Crystal
静的型付け言語 Crystal5t111111
 
畳み込みニューラルネットワークを用いた複単語表現の解析
畳み込みニューラルネットワークを用いた複単語表現の解析畳み込みニューラルネットワークを用いた複単語表現の解析
畳み込みニューラルネットワークを用いた複単語表現の解析奈良先端大 情報科学研究科
 
物理ベースレンダラedupt解説
物理ベースレンダラedupt解説物理ベースレンダラedupt解説
物理ベースレンダラedupt解説h013
 
深層生成モデルと世界モデル(2020/11/20版)
深層生成モデルと世界モデル(2020/11/20版)深層生成モデルと世界モデル(2020/11/20版)
深層生成モデルと世界モデル(2020/11/20版)Masahiro Suzuki
 
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...Yuki Tomo
 
TensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vecTensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vecShin Asakawa
 

Similaire à Word2vec alpha (20)

【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks? 【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
【DL輪読会】How Much Can CLIP Benefit Vision-and-Language Tasks?
 
単語・句の分散表現の学習
単語・句の分散表現の学習単語・句の分散表現の学習
単語・句の分散表現の学習
 
単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展単語の分散表現と構成性の計算モデルの発展
単語の分散表現と構成性の計算モデルの発展
 
パターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvqパターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvq
 
2016word embbed
2016word embbed2016word embbed
2016word embbed
 
Neural word embedding as implicit matrix factorization の論文紹介
Neural word embedding as implicit matrix factorization の論文紹介Neural word embedding as implicit matrix factorization の論文紹介
Neural word embedding as implicit matrix factorization の論文紹介
 
Transformer メタサーベイ
Transformer メタサーベイTransformer メタサーベイ
Transformer メタサーベイ
 
Paper: seq2seq 20190320
Paper: seq2seq 20190320Paper: seq2seq 20190320
Paper: seq2seq 20190320
 
GPU上でのNLP向け深層学習の実装について
GPU上でのNLP向け深層学習の実装についてGPU上でのNLP向け深層学習の実装について
GPU上でのNLP向け深層学習の実装について
 
Chainerの使い方と 自然言語処理への応用
Chainerの使い方と自然言語処理への応用Chainerの使い方と自然言語処理への応用
Chainerの使い方と 自然言語処理への応用
 
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介
Get To The Point: Summarization with Pointer-Generator Networks_acl17_論文紹介
 
静的型付け言語 Crystal
静的型付け言語 Crystal静的型付け言語 Crystal
静的型付け言語 Crystal
 
畳み込みニューラルネットワークを用いた複単語表現の解析
畳み込みニューラルネットワークを用いた複単語表現の解析畳み込みニューラルネットワークを用いた複単語表現の解析
畳み込みニューラルネットワークを用いた複単語表現の解析
 
物理ベースレンダラedupt解説
物理ベースレンダラedupt解説物理ベースレンダラedupt解説
物理ベースレンダラedupt解説
 
2017 09-01-gengo
2017 09-01-gengo2017 09-01-gengo
2017 09-01-gengo
 
深層生成モデルと世界モデル(2020/11/20版)
深層生成モデルと世界モデル(2020/11/20版)深層生成モデルと世界モデル(2020/11/20版)
深層生成モデルと世界モデル(2020/11/20版)
 
Deep learning を用いた画像から説明文の自動生成に関する研究の紹介
Deep learning を用いた画像から説明文の自動生成に関する研究の紹介Deep learning を用いた画像から説明文の自動生成に関する研究の紹介
Deep learning を用いた画像から説明文の自動生成に関する研究の紹介
 
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...
ACL 2015 読み会 @ 小町研 "Gated Recursive Neural Network for Chinese Word Segmentat...
 
M1GP: A Word at a Time
M1GP: A Word at a TimeM1GP: A Word at a Time
M1GP: A Word at a Time
 
TensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vecTensorFlow math ja 05 word2vec
TensorFlow math ja 05 word2vec
 

Plus de KCS Keio Computer Society

Large scale gan training for high fidelity natural
Large scale gan training for high fidelity naturalLarge scale gan training for high fidelity natural
Large scale gan training for high fidelity naturalKCS Keio Computer Society
 
Vector-Based navigation using grid-like representations in artificial agents
 Vector-Based navigation using grid-like representations in artificial agents Vector-Based navigation using grid-like representations in artificial agents
Vector-Based navigation using grid-like representations in artificial agentsKCS Keio Computer Society
 
ゼロから作るDeepLearning 2~3章 輪読
ゼロから作るDeepLearning 2~3章 輪読ゼロから作るDeepLearning 2~3章 輪読
ゼロから作るDeepLearning 2~3章 輪読KCS Keio Computer Society
 
ゼロから作るDeepLearning 3.3~3.6章 輪読
ゼロから作るDeepLearning 3.3~3.6章 輪読ゼロから作るDeepLearning 3.3~3.6章 輪読
ゼロから作るDeepLearning 3.3~3.6章 輪読KCS Keio Computer Society
 
[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry
[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry
[論文略説]Stochastic Thermodynamics Interpretation of Information GeometryKCS Keio Computer Society
 

Plus de KCS Keio Computer Society (20)

Large scale gan training for high fidelity natural
Large scale gan training for high fidelity naturalLarge scale gan training for high fidelity natural
Large scale gan training for high fidelity natural
 
Imagenet trained cnns-are_biased_towards
Imagenet trained cnns-are_biased_towardsImagenet trained cnns-are_biased_towards
Imagenet trained cnns-are_biased_towards
 
機械学習ゼミ: Area attenttion
機械学習ゼミ: Area attenttion機械学習ゼミ: Area attenttion
機械学習ゼミ: Area attenttion
 
機械学習ゼミ 2018/10/17
機械学習ゼミ 2018/10/17機械学習ゼミ 2018/10/17
機械学習ゼミ 2018/10/17
 
機械学習ゼミ2018 06 15
機械学習ゼミ2018 06 15機械学習ゼミ2018 06 15
機械学習ゼミ2018 06 15
 
Control by deep learning
Control by deep learningControl by deep learning
Control by deep learning
 
深層学習 第6章
深層学習 第6章深層学習 第6章
深層学習 第6章
 
Vector-Based navigation using grid-like representations in artificial agents
 Vector-Based navigation using grid-like representations in artificial agents Vector-Based navigation using grid-like representations in artificial agents
Vector-Based navigation using grid-like representations in artificial agents
 
文章生成の未解決問題
文章生成の未解決問題文章生成の未解決問題
文章生成の未解決問題
 
テンソル代数
テンソル代数テンソル代数
テンソル代数
 
Hindsight experience replay
Hindsight experience replayHindsight experience replay
Hindsight experience replay
 
Kml 輪読514
Kml 輪読514Kml 輪読514
Kml 輪読514
 
ゼロから作るDeepLearning 5章 輪読
ゼロから作るDeepLearning 5章 輪読ゼロから作るDeepLearning 5章 輪読
ゼロから作るDeepLearning 5章 輪読
 
ELBO型VAEのダメなところ
ELBO型VAEのダメなところELBO型VAEのダメなところ
ELBO型VAEのダメなところ
 
ゼロから作るDeepLearning 2~3章 輪読
ゼロから作るDeepLearning 2~3章 輪読ゼロから作るDeepLearning 2~3章 輪読
ゼロから作るDeepLearning 2~3章 輪読
 
ゼロから作るDeepLearning 4章 輪読
ゼロから作るDeepLearning 4章 輪読ゼロから作るDeepLearning 4章 輪読
ゼロから作るDeepLearning 4章 輪読
 
Soft Actor Critic 解説
Soft Actor Critic 解説Soft Actor Critic 解説
Soft Actor Critic 解説
 
ゼロから作るDeepLearning 3.3~3.6章 輪読
ゼロから作るDeepLearning 3.3~3.6章 輪読ゼロから作るDeepLearning 3.3~3.6章 輪読
ゼロから作るDeepLearning 3.3~3.6章 輪読
 
[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry
[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry
[論文略説]Stochastic Thermodynamics Interpretation of Information Geometry
 
Graph Convolutional Network 概説
Graph Convolutional Network 概説Graph Convolutional Network 概説
Graph Convolutional Network 概説
 

Word2vec alpha

  • 1. word2vec + 𝛼 mt_caret kml輪講 2018-05-25 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 1 / 28
  • 2. 全体の流れ 自然言語処理に関して何も知らないところからword2vecの仕組みとその後の発展ま でを追う。 Linguistic Regularities in Continuous Space Word Representations Efficient Estimation of Word Representations in Vector Space Distributed Representations of Words and Phrases and their Compositionality (word2vec Parameter Learning Explained) (word2vec Explained: Deriving Mikolov et al’s Negative Sampling Word-Embedding Method) mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 2 / 28
  • 3. 語の表現方法 図 1: One-hotベクトル (https://blog.acolyer.orgより引用) 𝑦𝑦𝑦 = 𝑓(𝑊𝑊𝑊𝑥𝑥𝑥)のようなモデルを考えた時、 𝑥𝑥𝑥が語に対応する One-hotベクトルだと 考えると 𝑊𝑊𝑊𝑥𝑥𝑥は 𝑊𝑊𝑊の一列を取り出していると考えることができる。したがっ て、 𝑊𝑊𝑊の各列は語に対応していると解釈できる。 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 3 / 28
  • 5. Linguistic Regularities in Continuous Space Word Representations mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 5 / 28
  • 6. Linguistic Regularities in Continuous Space Word Representations これらの分散表現は言語における統語構造・意味構造が上手く反映されている。 統語構造: apple − apples ≃ car − cars 意味構造: woman − man ≃ queen − king 図 3: 分散表現 (https://blog.acolyer.orgより引用) mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 6 / 28
  • 7. Linguistic Regularities in Continuous Space Word Representations 統語構造・意味構造の検証のためのテストセットを用意し 𝑎 ∶ 𝑏, 𝑐 ∶ 𝑑という関係性 において 𝑑を求めたい語とした時、 𝑏 − 𝑎 + 𝑐にコサイン距離が最も近い語を答えと し、正答率を検証。 図 4: 統語構造のテストセット mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 7 / 28
  • 8. Linguistic Regularities in Continuous Space Word Representations mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 8 / 28
  • 9. Efficient Estimation of Word Representations in Vector Space mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 9 / 28
  • 10. Efficient Estimation of Word Representations in Vector Space 𝑂 = 𝐸 × 𝑇 × 𝑄 O: 学習に掛かる計算量 E: データセットの大きさ(語数) Q: モデル依存 NNベースのモデル(NNLM) 𝑄 = 𝑁 × 𝐷 + 𝑁 × 𝐷 × 𝐻 + 𝐻 × 𝑉 N: 入力語数 D: 投影先の次元 H: 分散表現の次元 V: Vocabularyの大きさ mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 10 / 28
  • 11. Efficient Estimation of Word Representations in Vector Space 𝑂 = 𝐸 × 𝑇 × 𝑄 O: 学習に掛かる計算量 E: データセットの大きさ(語数) Q: モデル依存 RNNベースのモデル(RNNLM) 𝑄 = 𝐻 × 𝐻 + 𝐻 × 𝑉 H: 分散表現の次元 V: Vocabularyの大きさ mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 11 / 28
  • 12. Efficient Estimation of Word Representations in Vector Space 図 5: Continuous Bag-of-Words(CBOW)とContinuous Skip-gramモデル mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 12 / 28
  • 13. word2vec Parameter Learning Explained ℎℎℎ = 𝑥𝑥𝑥 𝑇 𝑊𝑊𝑊 図 6: 1語入力のCBOWモデル mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 13 / 28
  • 14. word2vec Parameter Learning Explained ℎℎℎ = 1 𝐶 𝑊𝑊𝑊 (𝑥𝑥𝑥1 + 𝑥𝑥𝑥2 + ⋯ + 𝑥𝑥𝑥 𝐶) 図 7: 多語入力のCBOWモデル mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 14 / 28
  • 15. word2vec Parameter Learning Explained モデルの構造は1語入力のCBOWと同じだが、出力 𝑦をコンテキストの語全てと比較 して交差エントロピーロスを計算する。 図 8: Skip-gramモデル mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 15 / 28
  • 16. word2vec Parameter Learning Explained Hierarchical Softmax 通常のSoftmaxだと分母で出力列ベクトルの全ての行を計算する必要があり、 𝐻 × 𝑉 の計算が必要になっていた。そこで、各語を表す行に行き着く確率を二分木 と各枝での左右への遷移確率をシグモイドでモデル化する。すると、各枝では 𝐻 × 1の計算で済みlog2(𝑉 )回の遷移で語にたどり着くため 𝐻 × 𝑉 が 𝐻 × log2(𝑉 )になる。 𝑃(”time”|𝐶) = 𝑃 𝑛0 (right|𝐶)𝑃 𝑛1 (left|𝐶)𝑃 𝑛2 (right|𝐶) 図 9: Hierarchical Softmaxの図 (http://building-babylon.net/より引用) mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 16 / 28
  • 17. Efficient Estimation of Word Representations in Vector Space 𝑂 = 𝐸 × 𝑇 × 𝑄 O: 学習に掛かる計算量 E: データセットの大きさ(語数) Q: モデル依存 Continuous Bag-of-Wordsモデル(CBOW) 𝑄 = 𝐶 × 𝐷 + 𝐷 × 𝑙𝑜𝑔2(𝑉 ) C: 入力語数 D: 投影先の次元かつ分散表現の次元(同一) V: Vocabularyの大きさ mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 17 / 28
  • 18. Efficient Estimation of Word Representations in Vector Space 𝑂 = 𝐸 × 𝑇 × 𝑄 O: 学習に掛かる計算量 E: データセットの大きさ(語数) Q: モデル依存 Continuous Skip-gramモデル(CBOW) 𝑄 = 𝐶 × (𝐷 + 𝐷 × 𝑙𝑜𝑔2(𝑉 )) C: 予測する語数 D: 投影先の次元かつ分散表現の次元(同一) V: Vocabularyの大きさ mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 18 / 28
  • 19. Efficient Estimation of Word Representations in Vector Space We observe large improvements in accuracy at much lower computa- tional cost, i.e. it takes less than a day to learn high quality word vectors from a 1.6 billion words data set. Furthermore, we show that these vectors provide state-of-the-art performance on our test set for measuring syntactic and semantic word similarities. 図 10: CBOWとSkip-gramの結果 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 19 / 28
  • 20. Efficient Estimation of Word Representations in Vector Space We observe large improvements in accuracy at much lower computa- tional cost, i.e. it takes less than a day to learn high quality word vectors from a 1.6 billion words data set. Furthermore, we show that these vectors provide state-of-the-art performance on our test set for measuring syntactic and semantic word similarities. 図 11: 計算時間 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 20 / 28
  • 21. Efficient Estimation of Word Representations in Vector Space The training speed is significantly higher than reported earlier in this paper, i.e. it is in the order of billions of words per hour for typical hyperparameter choices. We also published more than 1.4 million vec- tors that represent named entities, trained on more than 100 billion words. Some of our follow-up work will be published in an upcoming NIPS 2013 paper. mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 21 / 28
  • 22. Distributed Representations of Words and Phrases and their Compositionality Negative Sampling Subsampling Learning Phrases mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 22 / 28
  • 23. word2vec Parameter Learning Explained Negative Sampling そもそもSoftmaxを使わずNoise Contrastive Estimation(NCE)の近似である Negative Sampling(NEG)を行う。具体的には正解の語を最大化し、データセットか ら 𝑘個語を引いてそれらを最小化することを目標として学習する。 log 𝜎 (𝑣′ 𝑤 𝑂 𝑣 𝑇 𝑤 𝐼 ) + 𝑘 ∑ =1 𝔼 𝑤 𝑖∼𝑃 𝑛(𝑤)[− log 𝜎 (𝑣′ 𝑤 𝑖 𝑣 𝑇 𝑤 𝐼 )] mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 23 / 28
  • 24. Distributed Representations of Words and Phrases and their Compositionality Subsampling 頻出語(“in”, “the”, “a”, etc.のストップワード等)は情報が少ないため、確率 𝑃(𝑤 𝑖) = 1 − √ 𝑡 𝑓(𝑤 𝑖) の確率で語を捨てる処理をコーパスについて行った後にword2vecの学習を行う。こ この 𝑡は適当に決める(10−5 前後が典型的)。 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 24 / 28
  • 25. Distributed Representations of Words and Phrases and their Compositionality Learning for Phrases 単体で出現する確率(unigram)と2語連続して出現する確率(bigram)を用いて以下の スコアを計算し、閾値を超えたものは新しい語としてVocabularyに追加する。これ を閾値を下げながら何パスか行う。 score(𝑤 𝑖, 𝑤 𝑗) = count(𝑤 𝑖, 𝑤 𝑗) − 𝛿 count(𝑤 𝑖) × count(𝑤 𝑗) 図 12: 句を学習した結果 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 25 / 28
  • 26. Distributed Representations of Words and Phrases and their Compositionality この論文の成果がオープンソースとしてhttps://code.google.com/p/word2vecで 公開されていて、そのプロジェクトの名前がword2vec1 。 1 タイトル回収 mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 26 / 28
  • 27. +𝛼 Hierarchical Softmaxの木の作り方 (A Scalable Hierarchical Distributed Language Model) Poincare Embeddings (Poincaré Embeddings for Learning Hierarchical Representations) doc2vec (Distributed Representations of Sentences and Documents) mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 27 / 28
  • 28. 参考にした資料 The amazing power of word vectors | the morning paper Hierarchical Softmax – Building Babylon How does sub-sampling of frequent words work in the context of Word2Vec? - Quora Approximating the Softmax for Learning Word Embeddings A gentle introduction to Doc2Vec – ScaleAbout – Medium 異空間への埋め込み!Poincare Embeddingsが拓く表現学習の新展開 - ABEJA Arts Blog Neural Network Methods for Natural Language Processing mt_caret (kml輪講) word2vec + 𝛼 2018-05-25 28 / 28