Natural Language Processing · 免费预览

基于共现计数的词向量

分布假设、词—上下文共现矩阵,以及作为语义向量标准相似度度量的余弦相似度。

1. Word Vectors from Co-Occurrence Counts

Word Vectors from Co-Occurrence Counts

2. The word-context matrix

The word-context matrix

3. Counting the harbour logbook

Counting the harbour logbook

4. Cosine of two count vectors

Two words have context vectors over the same dimensions. Word A has a nonzero count (1) in a dimension where word B is zero, and word B has a nonzero count (3) in a dimension where word A is zero, and they share no dimension where both are nonzero. What is their cosine similarity? Answer as a decimal.

5. Cosine of two small vectors

Compute cos⁡(v,w)\cos(\mathbf{v}, \mathbf{w}) for v=[3,1]\mathbf{v} = [3, 1] and w=[1,2]\mathbf{w} = [1, 2] and round to three decimals.

6. Why divide by the lengths?

A raw dot product ranks ferry as more similar to a very frequent word than to tug, even though ferry and tug share most of their contexts. Why does the cosine fix this?

7. One cell of the co-occurrence matrix

In a corpus, the word "gull" occurs in 3 sentences, and in every one of those sentences "mast" appears exactly once inside the context window around "gull". What value goes in the cell for row "gull", column "mast" of the word-context matrix? Answer with the number.

8. Two words with identical rows

Two words accumulate exactly the same context counts over a corpus, every dimension matching. What is their cosine, and what does the outcome mean?

进入交互式练习

免费注册 · 即时批改 · 自动安排间隔复习。

免费开始这门课