Question: In this assignment, you will carry out hyperparameter tuning for the MNIST handwritten digit dataset, using both grid search and random search (see sklearn documentation).

In this assignment, you will carry out hyperparameter tuning for the MNIST handwritten digit dataset, using both grid search and random search (see sklearn documentation). Complete the following tasks: (a) The baseline model for your task should be a SVM with a linear kernel. Train this model on your training data and evaluate the accuracy on the testing data. (b) To improve upon this baseline, try a SVM with a radial basis function (RBF) kernel. Since you will find that the RBF-SVM model performs better than the linear-SVM model, the former will be the proper candidate for our hyperparameter study. (c) Carry out a hyperparameter tuning study for the SVM model with RBF kernel. There are two parameters influencing the model, ~ (the RBF shape parameter) and C (the regularization parameter). Both 7 and C have default values for the given problem (read the sklearn.svm.SVC documentation to find/compute those default values). (d) For both grid search and random search set up a meaningful search space for your parameters, e.g. logarithmically spaced intervals containing the default parameters. Note that if your grid search or random search yields optimal hyperparameter values that are at the boundary of your search domains, then your search space may have been too narrow, and you will have to extend those search domains to make sure that you indeed found the optimal values for the parameters. (e) Report on the computational efficiency of grid search vs. random search, e.g. by clock- ing the total time it took to complete each algorithm to find suitable hyperparameter values. (f) Once you have found these optimal hyperparameters, train your models with them. Do the optimal parameters found by grid search or those found by random search give the best overall model? 17 TTT In this assignment, you will carry out hyperparameter tuning for the MNIST handwritten digit dataset, using both grid search and random search (see sklearn documentation). Complete the following tasks: (a) The baseline model for your task should be a SVM with a linear kernel. Train this model on your training data and evaluate the accuracy on the testing data. (b) To improve upon this baseline, try a SVM with a radial basis function (RBF) kernel. Since you will find that the RBF-SVM model performs better than the linear-SVM model, the former will be the proper candidate for our hyperparameter study. (c) Carry out a hyperparameter tuning study for the SVM model with RBF kernel. There are two parameters influencing the model, ~ (the RBF shape parameter) and C (the regularization parameter). Both 7 and C have default values for the given problem (read the sklearn.svm.SVC documentation to find/compute those default values). (d) For both grid search and random search set up a meaningful search space for your parameters, e.g. logarithmically spaced intervals containing the default parameters. Note that if your grid search or random search yields optimal hyperparameter values that are at the boundary of your search domains, then your search space may have been too narrow, and you will have to extend those search domains to make sure that you indeed found the optimal values for the parameters. (e) Report on the computational efficiency of grid search vs. random search, e.g. by clock- ing the total time it took to complete each algorithm to find suitable hyperparameter values. (f) Once you have found these optimal hyperparameters, train your models with them. Do the optimal parameters found by grid search or those found by random search give the best overall model? 17 TTT
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
