1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with PyTorch

Connected

Exercise

Implementing random search

Hyperparameter search is a computationally costly approach to experiment with different hyperparameter values. However, it can lead to performance improvements. In this exercise, you will implement a random search algorithm.

You will randomly sample 10 values of the learning rate and momentum from the uniform distribution. To do so, you will use the np.random.uniform() function.

numpy package has already been imported as np, and a plot_hyperparameter_search() function has been created to visualize your results.

Instructions

100 XP
  • Randomly sample a learning rate factor between 2 and 4 so that the learning rate (lr) is bounded between \(10^{-2}\) and \(10^{-4}\).
  • Randomly sample a momentum between 0.85 and 0.99.