[cs224n] Lecture 2 – Word Vectors and Word Senses

Lecture 2 – Word Vectors and Word Senses

[cs224n] Lecture 2 – Word Vectors and Word Senses_第1张图片


1. Review: Main idea of word2vec

[cs224n] Lecture 2 – Word Vectors and Word Senses_第2张图片

Word2vec parameters and computations

[cs224n] Lecture 2 – Word Vectors and Word Senses_第3张图片

Word2vec maximizes objective function by putting similar words nearby in space

[cs224n] Lecture 2 – Word Vectors and Word Senses_第4张图片

 

2. Optimization: Gradient Descent

[cs224n] Lecture 2 – Word Vectors and Word Senses_第5张图片

Gradient Descent

[cs224n] Lecture 2 – Word Vectors and Word Senses_第6张图片

Stochastic Gradient Descent

[cs224n] Lecture 2 – Word Vectors and Word Senses_第7张图片

Stochastic gradients with word vectors!

[cs224n] Lecture 2 – Word Vectors and Word Senses_第8张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第9张图片

1b. Word2vec: More details

So far, we have looked at two main classes of methods to find word embeddings. The first set are count-based and rely on matrix factorization (e.g. LSA, HAL). While these methods effectively leverage global statistical information, they are primarily used to capture word similarities and do poorly on tasks such as word analogy, indicating a sub-optimal vector space structure. The other set of methods are shallow window-based (e.g. the skip-gram and the CBOW models), which learn word embeddings by making predictions in local context windows. These models demonstrate the capacity to capture complex linguistic patterns beyond word similarity, but fail to make use of the global co-occurrence statistics.

[cs224n] Lecture 2 – Word Vectors and Word Senses_第10张图片

The skip-gram model with negative sampling (HW2)

[cs224n] Lecture 2 – Word Vectors and Word Senses_第11张图片

In comparison, GloVe consists of a weighted least squares model that trains on global word-word co-occurrence counts and thus makes efficient use of statistics. The model produces a word vector space with meaningful sub-structure. It shows state-of-the-art performance on the word analogy task, and outperforms other current methods on several word similarity tasks. 

[cs224n] Lecture 2 – Word Vectors and Word Senses_第12张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第13张图片


3. But why not capture co-occurrence counts directly?

[cs224n] Lecture 2 – Word Vectors and Word Senses_第14张图片

Example: Window based co-occurrence matrix

[cs224n] Lecture 2 – Word Vectors and Word Senses_第15张图片

Window based co-occurrence matrix

[cs224n] Lecture 2 – Word Vectors and Word Senses_第16张图片

Problems with simple co-occurrence vectors

[cs224n] Lecture 2 – Word Vectors and Word Senses_第17张图片

Solution: Low dimensional vectors

[cs224n] Lecture 2 – Word Vectors and Word Senses_第18张图片

Method 1: Dimensionality Reduction on X (HW1)

[cs224n] Lecture 2 – Word Vectors and Word Senses_第19张图片

Simple SVD word vectors in Python

[cs224n] Lecture 2 – Word Vectors and Word Senses_第20张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第21张图片

Hacks to X (several used in Rohde et al. 2005)

[cs224n] Lecture 2 – Word Vectors and Word Senses_第22张图片

Interesting syntactic patterns emerge in the vectors

[cs224n] Lecture 2 – Word Vectors and Word Senses_第23张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第24张图片

Count based vs. direct prediction

[cs224n] Lecture 2 – Word Vectors and Word Senses_第25张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第26张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第27张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第28张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第29张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第30张图片

How to evaluate word vectors?

[cs224n] Lecture 2 – Word Vectors and Word Senses_第31张图片

Intrinsic word vector evaluation

[cs224n] Lecture 2 – Word Vectors and Word Senses_第32张图片

Glove Visualizations

[cs224n] Lecture 2 – Word Vectors and Word Senses_第33张图片

Glove Visualizations: Company - CEO

[cs224n] Lecture 2 – Word Vectors and Word Senses_第34张图片

Glove Visualizations: Superlatives

[cs224n] Lecture 2 – Word Vectors and Word Senses_第35张图片

Details of intrinsic word vector evaluation

[cs224n] Lecture 2 – Word Vectors and Word Senses_第36张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第37张图片

Analogy evaluation and hyperparameters

[cs224n] Lecture 2 – Word Vectors and Word Senses_第38张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第39张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第40张图片

 Analogy evaluation and hyperparameters

[cs224n] Lecture 2 – Word Vectors and Word Senses_第41张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第42张图片

Another intrinsic word vector evaluation

[cs224n] Lecture 2 – Word Vectors and Word Senses_第43张图片

Closest words to “Sweden” (cosine similarity)

[cs224n] Lecture 2 – Word Vectors and Word Senses_第44张图片

Correlation evaluation

[cs224n] Lecture 2 – Word Vectors and Word Senses_第45张图片

 Word senses and word sense ambiguity

[cs224n] Lecture 2 – Word Vectors and Word Senses_第46张图片

pike

[cs224n] Lecture 2 – Word Vectors and Word Senses_第47张图片

Improving Word Representations Via Global Context And Multiple Word Prototypes (Huang et al. 2012)

[cs224n] Lecture 2 – Word Vectors and Word Senses_第48张图片

Linear Algebraic Structure of Word Senses, with Applications to Polysemy

[cs224n] Lecture 2 – Word Vectors and Word Senses_第49张图片

Extrinsic word vector evaluation

[cs224n] Lecture 2 – Word Vectors and Word Senses_第50张图片

Course plan: coming weeks

[cs224n] Lecture 2 – Word Vectors and Word Senses_第51张图片

[cs224n] Lecture 2 – Word Vectors and Word Senses_第52张图片

Office Hours / Help sessions

[cs224n] Lecture 2 – Word Vectors and Word Senses_第53张图片

 

 

 

 

你可能感兴趣的:(Stanford-cs224n)