プリンキピア

第11章注意機構とTransformer

11.2.5. Exercises11.2.5 練習問題

  1. Parzen windows density estimates are given by pˆ(𝐱)=1n∑ik(𝐱,𝐱i). Prove that for binary classification the function pˆ(𝐱,y=1)−pˆ(𝐱,y=−1), as obtained by Parzen windows is equivalent to Nadaraya–Watson classification.
    英語のヒント
    パルツェン窓による密度推定はpˆ(𝐱)=1n∑ik(𝐱,𝐱i)で与えられる。二値分類について、パルツェン窓で得られる関数pˆ(𝐱,y=1)−pˆ(𝐱,y=−1)が、ナダラヤ・ワトソンの分類と同値であることを証明せよ。
  2. Implement stochastic gradient descent to learn a good value for kernel widths in Nadaraya–Watson regression.
    英語のヒント
    ナダラヤ・ワトソン回帰のカーネルの幅のよい値を学習するため、確率的勾配降下法を実装せよ。
    1. What happens if you just use the above estimates to minimize (f(𝐱𝐢)−yi)2 directly? Hint: yi is part of the terms used to compute f.
      英語のヒント
      上の推定値を使って(f(𝐱𝐢)−yi)2を直接最小化すると何が起きるか。ヒント:yiはfを計算するのに使う項の一部である。
    2. Remove (𝐱i,yi) from the estimate for f(𝐱i) and optimize over the kernel widths. Do you still observe overfitting?
      英語のヒント
      f(𝐱i)の推定から(𝐱i,yi)を取り除き、カーネルの幅について最適化せよ。それでも過学習が観察されるか。
  3. Assume that all 𝐱 lie on the unit sphere, i.e., all satisfy ∥𝐱∥=1. Can you simplify the ∥𝐱−𝐱i∥2 term in the exponential? Hint: we will later see that this is very closely related to dot product attention.
    英語のヒント
    すべての𝐱が単位球面上にある、つまりすべてが∥𝐱∥=1を満たすとする。指数関数の中の∥𝐱−𝐱i∥2の項を単純にできるか。ヒント:これが内積注意ととても密接に関係していることを後で見る。
  4. Recall that Mack and Silverman (1982) proved that Nadaraya–Watson estimation is consistent. How quickly should you reduce the scale for the attention mechanism as you get more data? Provide some intuition for your answer. Does it depend on the dimensionality of the data? How?
    英語のヒント
    Mack and Silverman (1982)が、ナダラヤ・ワトソン推定が一致性をもつことを証明したことを思い出そう。データが増えるにつれて、注意機構のスケールをどれくらい速く小さくすべきか。答えの直観を示せ。それはデータの次元に依存するか。どのように依存するか。