プリンキピア

第19章ハイパーパラメータ最適化

19.3.5. Exercises19.3.5 練習問題

  1. Consider the DropoutMLP model implemented in Section 5.6, and used in Exercise 1 of Section 19.2.
    英語のヒント
    5.6節で実装し、19.2節の練習問題1で使ったDropoutMLPモデルを考えよう。
    1. Implement an objective function hpo_objective_dropoutmlp_synetune to be used with Syne Tune. Make sure that your function reports the validation error after every epoch.
      英語のヒント
      Syne Tuneで使う目的関数hpo_objective_dropoutmlp_synetuneを実装せよ。その関数が、エポックごとに検証誤差を報告するようにせよ。
    2. Using the setup of Exercise 1 in Section 19.2, compare random search to Bayesian optimization. If you use SageMaker, feel free to use Syne Tune’s benchmarking facilities in order to run experiments in parallel. Hint: Bayesian optimization is provided as syne_tune.optimizer.baselines.BayesianOptimization.
      英語のヒント
      19.2節の練習問題1の設定を使って、ランダム探索とベイズ最適化を比べよ。SageMakerを使うなら、Syne Tuneのベンチマーク機能を自由に使って、実験を並列に実行してよい。ヒント:ベイズ最適化はsyne_tune.optimizer.baselines.BayesianOptimizationとして提供されている。
    3. For this exercise, you need to run on an instance with at least 4 CPU cores. For one of the methods used above (random search, Bayesian optimization), run experiments with n_workers=1, n_workers=2, n_workers=4, and compare results (incumbent trajectories). At least for random search, you should observe linear scaling with respect to the number of workers. Hint: For robust results, you may have to average over several repetitions each.
      英語のヒント
      この練習問題では、少なくとも4個のCPUコアをもつインスタンスで実行する必要がある。上で使った方法の一つ(ランダム探索、ベイズ最適化)について、n_workers=1、n_workers=2、n_workers=4で実験を実行し、結果(暫定最良解の軌跡)を比べよ。少なくともランダム探索では、ワーカーの数について線形のスケーリングが観察されるはずである。ヒント:頑健な結果を得るには、それぞれ何回かの繰り返しで平均をとる必要があるかもしれない。
  2. Advanced. The goal of this exercise is to implement a new scheduler in Syne Tune.
    英語のヒント
    発展。この練習問題の目標は、Syne Tuneに新しいスケジューラを実装することである。
    1. Create a virtual environment containing both the d2lbook and syne-tune sources.
      英語のヒント
      d2lbookとsyne-tuneの両方のソースを含む仮想環境を作れ。
    2. Implement the LocalSearcher from Exercise 2 in Section 19.2 as a new searcher in Syne Tune. Hint: Read this tutorial. Alternatively, you may follow this example.
      英語のヒント
      19.2節の練習問題2のLocalSearcherを、Syne Tuneの新しいサーチャーとして実装せよ。ヒント:このチュートリアルを読め。あるいは、この例に従ってもよい。
    3. Compare your new LocalSearcher with RandomSearch on the DropoutMLP benchmark.
      英語のヒント
      DropoutMLPのベンチマークで、新しいLocalSearcherをRandomSearchと比べよ。