Word Embeddings
CS6501: Vision and Language
What we see
How to represent a word?
dog
cat
person
1
2
3
Problem: distance between words using one-hot encodings always the same
Idea: Instead of one-hot-encoding use a histogram of commonly co-occurring words.
CS6501: Vision and Language
What we see
Distributional Semantics
dog
I saw a dog on a leash walking in the park.
Dogs are man’s best friend.
He walks his dog in the late afternoon
…
friend
leash
park
walking
walks
food
legs
runs
sleeps
sits
…
His dog is his best companion.
CS6501: Vision and Language
What we see
Distributional Semantics
dog
cat
person
food
walks
window
runs
mouse
invented
legs
sleeps
mirror
tail
…
This vocabulary can be extremely large
CS6501: Vision and Language
What we see
Toward more Compact Representations
dog
cat
person
food
walks
window
runs
mouse
invented
legs
sleeps
mirror
tail
…
This vocabulary can be extremely large
CS6501: Vision and Language
What we see
Toward more Compact Representations
dog =
=
legs, running, �walking
w1
+ w2
+ w3
tail, fur,
ears
mirror, window,�door
+ …
CS6501: Vision and Language
What we see
Toward more Compact Representations
dog =
w1
w2
w3
The basis vectors can be found using Principal Component Analysis (PCA)
CS6501: Vision and Language
What is word2vec?
Slide by Omer Levy
Embeddings capture relational meaning!
Slide by Dan Jurafsky
Skip-Grams with Negative Sampling (SGNS)
Marco saw a furry little wampimuk hiding in the tree.
10
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Skip-Grams with Negative Sampling (SGNS)
Marco saw a furry little wampimuk hiding in the tree.
11
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Skip-Grams with Negative Sampling (SGNS)
Marco saw a furry little wampimuk hiding in the tree.
words contexts
wampimuk furry
wampimuk little
wampimuk hiding
wampimuk in
… …
12
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Skip-Grams with Negative Sampling (SGNS)
13
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Word2Vec Objective
14
Word2Vec Objective
15
Skip-Grams with Negative Sampling (SGNS)
16
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Skip-Grams with Negative Sampling (SGNS)
17
“word2vec Explained…”
Goldberg & Levy, arXiv 2014
Skip-Grams with Negative Sampling (SGNS)
18
19
Questions?
CS6501: Vision and Language