Professional Documents
Culture Documents
Xu-Ly-Ngon-Ngu-Tu-Nhien - Kai-Wei-Chang - 07-Wordembedding - (Cuuduongthancong - Com)
Xu-Ly-Ngon-Ngu-Tu-Nhien - Kai-Wei-Chang - 07-Wordembedding - (Cuuduongthancong - Com)
Embeddings
Kai-Wei Chang
CS @ University of Virginia
kw@kwchang.net
v Data representation
v Encode single-relational data in a matrix
v Co-occurrence (e.g., from a general corpus)
v Synonyms (e.g., from a thesaurus)
v Factorization
v Apply SVD to the matrix to find latent
components
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Recap: Mapping to Latent Space via SVD
𝚺
𝐕'
𝑪 ≈ 𝐔
𝑘×𝑘 𝑘×𝑛
𝑑×𝑛 𝑑×𝑘
v SVD generalizes the original data
v Uncovers relationships not explicit in the thesaurus
v Term vectors projected to 𝑘-dim latent space
v Word similarity:
cosine of two column vectors in 𝚺𝐕 $
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Low rank approximation
||𝐶||/ = 1 1 |𝑐34 |5
378 478
v Rank of a matrix.
v How many vectors in the matrix are
independent to each other
v What differences?
v m is usually 5~10
v Gradient:
𝒙' = 𝑥8 𝑥5 𝑥z ,
𝜕𝜙(𝒙)
𝜕𝑥8
𝜕𝜙(𝒙)
∇𝜙 𝒙 =
𝜕𝑥5
𝜕𝜙(𝒙)
𝜕𝑥z
v 𝜙 𝒙 = 𝒂 ⋅ 𝒙 (or represented as 𝒂' 𝒙)
∇𝜙 𝒙 = 𝒂
6501 Natural Language Processing 16
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Recap: Calculus
1. 𝑦 = 𝑥 ˆ + 6 z 2. y = ln (𝑥 5 + 5)
3. y = exp(x • + 3𝑥 + 2)
v 𝑦 = exp 𝑥
dy
= exp x
dx
v y = log x
dy 1
=
dx x
min 𝐽(𝑤)
p
Update w: 𝑤 ← 𝑤 − 𝜂∇𝐽(𝑤)
sunny
rainy
cloudy windy
car
cab emotion sad
wheel
joy
feeling
Tomorrow will
be rainy.
Tomorrow will
be sunny.
𝑠𝑖𝑚𝑖𝑙𝑎𝑟(rainy, sunny)?
𝑎𝑛𝑡𝑜𝑛𝑦𝑚(rainy, sunny)?
v Data representation
v Encode two opposite relations in a matrix using
“polarity”
v Synonyms & antonyms (e.g., from a thesaurus)
v Factorization
v Apply SVD to the matrix to find latent
components
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Encode Synonyms & Antonyms in Matrix
Group 1: “joyfulness” 1 1 -1 -1 0
Group 2: “sad” -1 -1 1 1 0
Group 3: “affection” 0 0 0 0 1
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Encode Synonyms & Antonyms in Matrix
Group 1: “joyfulness” 1 1 -1 -1 0
Group 2: “sad” -1 -1 1 1 0
Group 3: “affection” 0 0 0 0 1
CuuDuongThanCong.com https://fb.com/tailieudientucntt
Continuous representations for entities
Democratic Party
Republic Party
George W Bush