Question: This problem involves the OJ data set in the ISLR package. a ) Create a training set containing a random sample of 9 0 0

This problem involves the
OJ
data set in the
ISLR
package.
a)
Create a training set containing a random sample of 900 observations and a test set containg the
remaining observations.
b)
Fit a support vector classifier to the training set 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 CV to select an optimal
cost
. Consider values between
0
.
01
and
10
.
e) Compute the training and test error rates using this new value for
cost
.
f)
Repeat b) through e) using a support vector machine with a radial kernal and default value for
gamma
.
g) Repeat b) through e) using a support vector machine with a polynomial kernal and
degree =2
.
h) Which approach gives the best results on this data?
4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!