プリンキピア

第2章準備

2.5.6. Exercises2.5.6 練習問題

  1. Why is the second derivative much more expensive to compute than the first derivative?
    英語のヒント
    2階導関数の計算が1階導関数よりずっと費用がかかるのはなぜか。
  2. After running the function for backpropagation, immediately run it again and see what happens. Investigate.
    英語のヒント
    誤差逆伝播の関数を実行した後、すぐにもう一度実行して、何が起きるかを見よ。調べてみよ。
  3. In the control flow example where we calculate the derivative of d with respect to a, what would happen if we changed the variable a to a random vector or a matrix? At this point, the result of the calculation f(a) is no longer a scalar. What happens to the result? How do we analyze this?
    英語のヒント
    aについてのdの導関数を計算する制御フローの例で、変数aを無作為なベクトルや行列に変えたら何が起きるか。この場合、計算f(a)の結果はもはやスカラーではない。結果はどうなるか。これをどう分析すればよいか。
  4. Let f(x)=sin⁡(x). Plot the graph of f and of its derivative f′. Do not exploit the fact that f′(x)=cos⁡(x) but rather use automatic differentiation to get the result.
    英語のヒント
    f(x)=sin⁡(x)とする。fとその導関数f′のグラフを描け。f′(x)=cos⁡(x)であることは利用せず、自動微分を使って結果を得よ。
  5. Let f(x)=((log⁡x2)⋅sin⁡x)+x−1. Write out a dependency graph tracing results from x to f(x).
    英語のヒント
    f(x)=((log⁡x2)⋅sin⁡x)+x−1とする。xからf(x)へと結果をたどる依存グラフを書き出せ。
  6. Use the chain rule to compute the derivative dfdx of the aforementioned function, placing each term on the dependency graph that you constructed previously.
    英語のヒント
    連鎖律を使って、前述の関数の導関数dfdxを計算し、各項を先ほど作った依存グラフの上に置け。
  7. Given the graph and the intermediate derivative results, you have a number of options when computing the gradient. Evaluate the result once starting from x to f and once from f tracing back to x. The path from x to f is commonly known as forward differentiation, whereas the path from f to x is known as backward differentiation.
    英語のヒント
    グラフと中間の導関数の結果が与えられたとき、勾配を計算する方法にはいくつかの選択肢がある。xからfへ向かって一度、fからxへさかのぼって一度、結果を評価せよ。xからfへの経路は一般に前進微分、fからxへの経路は後退微分として知られる。
  8. When might you want to use forward, and when backward, differentiation? Hint: consider the amount of intermediate data needed, the ability to parallelize steps, and the size of matrices and vectors involved.
    英語のヒント
    前進微分を使いたいのはどんなときで、後退微分を使いたいのはどんなときか。ヒント:必要な中間データの量、手順を並列化できるかどうか、関わる行列やベクトルの大きさを考えよ。