第4章分類のための線形ニューラルネットワーク
4.4.7. Exercises4.4.7 練習問題
- In this section, we directly implemented the softmax function based on the mathematical definition of the softmax operation. As discussed in Section 4.1 this can cause numerical instabilities.
英語のヒント
この節では、ソフトマックス演算の数学的な定義にもとづいて、ソフトマックス関数を直接実装した。4.1節で論じたように、これは数値的な不安定さを引き起こしうる。- Test whether
softmaxstill works correctly if an input has a value of .英語のヒント
入力の値がのとき、softmaxがまだ正しく働くかを試せ。 - Test whether
softmaxstill works correctly if the largest of all inputs is smaller than ?英語のヒント
すべての入力のうち最大のものがより小さいとき、softmaxがまだ正しく働くかを試せ。 - Implement a fix by looking at the value relative to the largest entry in the argument.
英語のヒント
引数の中で最大の成分に対する相対的な値を見ることで、修正を実装せよ。
- Implement a
cross_entropyfunction that follows the definition of the cross-entropy loss function .英語のヒント
交差エントロピー損失関数の定義に従うcross_entropy関数を実装せよ。- Try it out in the code example of this section.
英語のヒント
この節のコード例で試してみよ。 - Why do you think it runs more slowly?
英語のヒント
それがより遅く動くのはなぜだと思うか。 - Should you use it? When would it make sense to?
英語のヒント
それを使うべきか。使うのが理にかなうのはどんなときか。 - What do you need to be careful of? Hint: consider the domain of the logarithm.
英語のヒント
何に注意する必要があるか。ヒント:対数の定義域を考えよ。
- Is it always a good idea to return the most likely label? For example, would you do this for medical diagnosis? How would you try to address this?
英語のヒント
最も可能性の高いラベルを返すのは、いつでもよい考えか。たとえば、医療の診断でこれをするだろうか。これにどう対処しようとするか。 - Assume that we want to use softmax regression to predict the next word based on some features. What are some problems that might arise from a large vocabulary?
英語のヒント
何らかの特徴量にもとづいて、ソフトマックス回帰で次の単語を予測したいとする。語彙が大きいことから生じうる問題には、どんなものがあるか。 - Experiment with the hyperparameters of the code in this section. In particular:
英語のヒント
この節のコードのハイパーパラメータで実験せよ。特に次を試せ。- Plot how the validation loss changes as you change the learning rate.
英語のヒント
学習率を変えるにつれて検証損失がどう変わるかをプロットせよ。 - Do the validation and training loss change as you change the minibatch size? How large or small do you need to go before you see an effect?
英語のヒント
ミニバッチの大きさを変えると、検証損失と訓練損失は変わるか。効果が見えるまでには、どれだけ大きく、あるいは小さくする必要があるか。