Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jun Xu Harbin Institute of Technology China

Similar presentations


Presentation on theme: "Jun Xu Harbin Institute of Technology China"— Presentation transcript:

1 Jun Xu Harbin Institute of Technology China
Word2Vec Explained I’d like to talk to you about how word embeddings are really improving distributional similarity. This is joint work with Yoav Goldberg and Ido Dagan. Jun Xu Harbin Institute of Technology China

2 Word Similarity & Relatedness
How similar is pizza to pasta? How related is pizza to Italy? Representing words as vectors allows easy computation of similarity Measure the semantic similarity between words As features for various supervised NLP tasks such as document classification, named entity recognition, and sentiment analysis If you’ve come to this talk, you’re probably all interested in measuring word similarity, or relatedness. For example, how similar is pizza to pasta? Or how related is pizza to Italy? Representing words as vectors has become a very convenient way to compute these similarities, For example, using their cosine.

3 What is word2vec? Now that we have an idea of how SGNS works,
I’m going to show you that it’s learning something very familiar.

4 What is word2vec? word2vec is not a single algorithm
word2vec is not deep learning It is a software package for representing words as vectors, containing: Two distinct models CBoW Skip-Gram (SG) Various training methods Negative Sampling (NS) Hierarchical Softmax Now, we’re going to focus on Skip-Grams with Negative Sampling, Which is considered the state-of-the-art.

5 Why Hierarchical Softmax?
Now that we have an idea of how SGNS works, I’m going to show you that it’s learning something very familiar.

6 Why Hierarchical Softmax?
Turn multinomial classification problem into multiple binomial classification problem If we take the embedding matrices

7 Why Negative Sampling? Now that we have an idea of how SGNS works,
I’m going to show you that it’s learning something very familiar.

8 Why Negative Sampling? Increase positive samples’ probability while decrease negative samples’ probability Hidden assumption: decrease negative samples’ probability means Increase positive samples’ probability Right? Maybe not! The Objective Function has changed already!! Vectors: word vector and parameter vector, not w_in and w_out If we take the embedding matrices

9 Put it all together Goal: Learn word vectors
Similar semantic means similar word vector Maximum likelihood estimation: MLE on words multinomial classification -> multiple binomial classification Hierarchical softmax MLE on word-context pairs Negative sampling Now, we’re going to focus on Skip-Grams with Negative Sampling, Which is considered the state-of-the-art.

10 Hierarchical Softmax Rethink
Now that we have an idea of how SGNS works, I’m going to show you that it’s learning something very familiar.

11 Hierarchical Softmax Rethink
Huffman tree and Hidden layers Change another tree structure other than Huffman tree Change the way that Huffman tree is built What is frequency? If we take the embedding matrices

12 Discuss Now that we have an idea of how SGNS works,
I’m going to show you that it’s learning something very familiar.

13 What is SGNS learning? Now that we have an idea of how SGNS works,
I’m going to show you that it’s learning something very familiar.

14 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? If we take the embedding matrices “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

15 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? And multiply them What do we get? “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

16 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? We get a pretty big, square matrix, Where each cell describes the relation between a specific word, w, With a specific context, c. “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

17 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? So in our NIPS paper, we proved that with enough dimensions and iterations… “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

18 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? …SGNS will converge to the classic word-context PMI matrix… “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

19 “Neural Word Embeddings as Implicit Matrix Factorization”
What is SGNS learning? …with a little twist. Now, recall that k is the number of negative samples generated for each positive example (w,c) \in D. This is of course the optimal value, and not necessarily what we get in practice. “Neural Word Embeddings as Implicit Matrix Factorization” Levy & Goldberg, NIPS 2014

20 What is SGNS learning? SGNS is doing something very similar to the older approaches SGNS is factorizing the traditional word-context PMI matrix So does SVD! GloVe factorizes a similar word-context matrix So to sum it up, SGNS is doing what we’ve been doing in NLP for a couple of decades: It’s factorizing the PMI matrix, Apparently, just like SVD. And, while I didn’t explain it, GloVe also factorizes a similar matrix.

21 That’s all Thanks for coming
Now that we have an idea of how SGNS works, I’m going to show you that it’s learning something very familiar.


Download ppt "Jun Xu Harbin Institute of Technology China"

Similar presentations


Ads by Google