Update page 'Questions concerning R language'
@@ -0,0 +1,36 @@
|
|||||||
|
*###Applied*
|
||||||
|
This problem involves the `OJ` data set which is part of the `ISLR` package.
|
||||||
|
* Create a training set containing a random sample of 800 observations, and a test set containing the remaining observations.
|
||||||
|
* 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.
|
||||||
|
* What are the training and test error rates?
|
||||||
|
* Use the `tune()` function to select an optimal cost. Consider values in the range 0.01 to 10.
|
||||||
|
* Compute the training and test error rates using this new value for `cost`.
|
||||||
|
* Repeat parts (ii) through (v) using a support vector machine with a radial kernel. Use the default value for `gamma`.
|
||||||
|
* Repeat parts (ii) through (v) using a support vector machine with a polynomial kernel. Set `degree=2`.
|
||||||
|
* Overall, which approach seems to give the best results on this data?
|
||||||
|
|
||||||
|
*###Conceptual*
|
||||||
|
Here we explore the maximal margin classifier on a toy data set.
|
||||||
|
* We are given n = 7 observations in p = 2 dimensions. For each observation, there is an associated class label.
|
||||||
|
| Obs. | X1 | X2 | Y |
|
||||||
|
| -------- | -------- | -------- | -------- |
|
||||||
|
| 1 | 3 | 4 | Red |
|
||||||
|
| 2 | 2 | 2 | Red |
|
||||||
|
| 3 | 4 | 4 | Red |
|
||||||
|
| 4 | 1 | 4 | Red |
|
||||||
|
| 5 | 2 | 1 | Blue |
|
||||||
|
| 6 | 4 | 3 | Blue |
|
||||||
|
| 7 | 4 | 1 | Blue |
|
||||||
|
|
||||||
|
Sketch the observations.
|
||||||
|
* Sketch the optimal separating hyperplane, and provide the equa- tion for this hyperplane.
|
||||||
|
* Describe the classification rule for the maximal margin classifier. It should be something along the lines of “Classify to Red if β0 + β1X1 + β2X2 > 0, and classify to Blue otherwise.” Provide the values for β0, β1, and β2.
|
||||||
|
* On your sketch, indicate the margin for the maximal margin hyperplane.
|
||||||
|
* Indicate the support vectors for the maximal margin classifier.
|
||||||
|
* Argue that a slight movement of the seventh observation would not affect the maximal margin hyperplane.
|
||||||
|
* Sketch a hyperplane that is not the optimal separating hyper- plane, and provide the equation for this hyperplane.
|
||||||
|
* Draw an additional observation on the plot so that the two classes are no longer separable by a hyperplane.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user