Instructions
For this homework, you should create a new folder in your homework
directory. Call it HW7
or something similar that you can
keep track of. Download the homework markdown template file
Student_HW_template.Rmd
from the course webpage, and put a
copy in this folder. Rename it something like
HW7_YourName.Rmd
. This markdown document will be where you
will answer each of the questions below.
The Assignment
SVMs: Classification
We’re going to load again the breast cancer classification data set:
<- read.csv("breast-cancer.csv") %>%
patients clean_names() %>%
mutate(
class = factor(class),
bland_chromatin = as.double(bland_chromatin),
single_epithelial_cell_size = as.double(single_epithelial_cell_size)
)
Exercise 1. Copy in your code to create a training and test set. Also create a 10 fold CV set.
Exercise 2. Create a recipe to that predicts
class
by all other variables. Make sure to normalize the
data.
Exercise 3. Create a model specifications for
nearest_neighbor
(with number of neighbors set to tune),
svm_poly
(tune the cost
and
degree
), and svm_rbf
(tune cost
and `rbf_sigma
). Add these and your recipe to a workflow
set.
Exercise 4. Use workflow_map
to tune
the models. Use autoplot to display the results, and pick the best
performing model. Report on your results.
Submitting HW
When you’ve successfully answered all the questions, knit your
document to a PDF file. Look through it to make sure everything worked
the way you expect it to. You will submit both your .Rmd
and .pdf
files to Schoology.