1. Learn
  2. /
  3. Courses
  4. /
  5. Hyperparameter Tuning in Python

Exercise

Building Learning Curves

If we want to test many different values for a single hyperparameter it can be difficult to easily view that in the form of a DataFrame. Previously you learned about a nice trick to analyze this. A graph called a 'learning curve' can nicely demonstrate the effect of increasing or decreasing a particular hyperparameter on the final result.

Instead of testing only a few values for the learning rate, you will test many to easily see the effect of this hyperparameter across a large range of values. A useful function from NumPy is np.linspace(start, end, num) which allows you to create a number of values (num) evenly spread within an interval (start, end) that you specify.

You will have available X_train, X_test, y_train & y_test datasets.

Instructions

100 XP
  • Create a list of 30 learning rates evenly spread between 0.01 and 2.
  • Create a similar loop to last exercise but just save out accuracy scores to a list.
  • Plot the learning rates against the accuracy score.