Intro to Statistical Learning (2nd Ed), Solution to Problem 9.8a
9.8A: This problem involves the OJ data set which is part of the ISLR2 package. (a) Create a training set containing a random sample of 800 observations, and a test set containing the remaining observations. (b) Fit a support vector classifier to the training data using cost = 0.01, with Purchase as the response and the other variables as predictors. Use the summary() function to produce summary statistics, and describe the results obtained (c) What are the training and test error rates? (d) Use the tune() function to select an optimal cost. Consider values in the range 0.01 to 10. (e) Compute the training and test error rates using this new value for cost. (f) Repeat parts (b) through (e) using a support vector machine with a radial kernel. Use the default value for gamma. (g) Repeat parts (b) through (e) using a support vector machine with a polynomial kernel. Set degree = 2. (h) Overall, which approach seems to give the best results on this data? Download Book: https://www.statlearning.com/ Authors' Lectures (R): https://youtube.com/playlist?list=PLoROMvodv4rOzrYsAxzQyHb8n_RWNuS1e&si=NP0wJ6RjP8XkxU7y Authors' Lectures (Python): https://youtube.com/playlist?list=PLoROMvodv4rPP6braWoRt5UCXYZ71GZIQ&si=0Z8tx4xlPLEyjZ70 https://colab.research.google.com/drive/1nC6mQqSwo8kjmvias_0JlQeVp2aZyKJD?usp=sharing
Download
0 formatsNo download links available.