Natural Language Processing · 免费预览

稠密嵌入与「Skip-Gram」

通过在上下文对上进行二分类训练得到的短稠密向量、从平滑一元语法分布中进行负采样的方法,以及嵌入空间的类比与偏见性质。

1. Dense Embeddings with Skip-Gram

Dense Embeddings with Skip-Gram

2. Negative sampling and its loss

Negative sampling and its loss

3. Training skip-gram in NumPy

Training skip-gram in NumPy

4. Skip-gram probability from a dot product

A target and context embedding have dot product c⋅w=−2\mathbf{c} \cdot \mathbf{w} = -2. Compute the classifier's probability P(+∣w,c)=σ(c⋅w)P(+ \mid w, c) = \sigma(\mathbf{c} \cdot \mathbf{w}) and round to three decimals.

5. Smoothing the noise distribution

A two-word lexicon has unigram probabilities 0.990.99 and 0.010.01. Compute the smoothed probability of the frequent word under P0.75P_{0.75}, that is 0.990.750.990.75+0.010.75\frac{0.99^{0.75}}{0.99^{0.75} + 0.01^{0.75}} and round to three decimals.

6. Skip-gram loss for one pair

A positive pair has cpos⋅w=1\mathbf{c}_{\text{pos}} \cdot \mathbf{w} = 1 and each of the 22 noise words has c⋅w=−1\mathbf{c} \cdot \mathbf{w} = -1. Compute the loss L=−[log⁡σ(1)+2log⁡σ(1)]L = -[\log \sigma(1) + 2 \log \sigma(1)] and round to three decimals.

7. Which way does the target move?

A training pair has label y=1y = 1 and the classifier currently outputs σ(c⋅w)=0.7\sigma(\mathbf{c} \cdot \mathbf{w}) = 0.7. According to the update w←w−η[σ(c⋅w)−y] c\mathbf{{w}} \leftarrow \mathbf{{w}} - \eta [\sigma(\mathbf{{c}} \cdot \mathbf{{w}}) - y]\,\mathbf{{c}}, what happens to the dot product c⋅w\mathbf{{c}} \cdot \mathbf{{w}} after the step?

8. Dense versus sparse, and structure

Which set of statements about static embeddings is correct?

进入交互式练习

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

免费开始这门课