Mathematics, 24.11.2021 22:00 joshloveshannah52651
In this question you will train a spam classifier using support vector machines. We will use the spam dataset which comes with the {kernlab} package. First, we will split the spam data randomly into two halves: one half we will use as the training data, the other half we will use as the test data. The target variable is type which is a binary class spam and nospam.
Use the following code fragment to get you started.
# install. packages("kernlab")
library(e1071)
library(kernlab)
data(spam)
dim(spam)
head(spam)
set. seed(02115)
sample <- sample( c(TRUE, FALSE), nrow(spam), replace=TRUE)
train <- spam[sample,]
test <- spam[!sample,]
1. Look at the help page for the dataset to find out what the different columns mean (hint:?spam).
2. Fit a support vector classifier using svm() on the training data. type is the target and all other variables can be used as predictors (hint: you can use the . notation which automatically includes all columns of the data. frame as predictors except the target variable).
3. Compute the classification error rate for the spam/nonspam classes on the test set (Hint: use the predict function on the test set predictors and compare your results with the ground-truth labels in the test set). Include the confusion matrix in your answer, along with the overall error rate
4. Now fit a support vector classifier again, but select sigmoid for the kernel and 100 as the cost parameter. What is the classification error in this scenario? What does this suggest to you?
5. How easy is it to interpret the classification performed using svm? Compare the interpretability of the svm model to that of a regression model (e. g., like the one from the question above).
6. Perform 10 fold cross validation, either writing your own function or using the tune() function to find the best hyper parameter
Answers: 3
Mathematics, 21.06.2019 23:10, toricepeda82
In which quadrant does the point lie? write the coordinates of the point. a. quadrant ii; (–2, –4) b. quadrant iii; (2, 4) c. quadrant iii; (–2, –4) d. quadrant iv; (–4, –2)
Answers: 3
Mathematics, 22.06.2019 00:00, angeleyes42
Macy spent $36 on jeans. this was $12 less than twice what she spent on a shirt. which equation to solve this, 12x=36 2x=36-12 2x-12=36 12-2x=36
Answers: 1
Mathematics, 22.06.2019 03:30, tremainewoodley3030
Identify the number as a rational or irrational. explai. 291.87
Answers: 2
In this question you will train a spam classifier using support vector machines. We will use the spa...
Mathematics, 05.11.2020 04:40
Mathematics, 05.11.2020 04:40
Physics, 05.11.2020 04:40
Mathematics, 05.11.2020 04:40
Mathematics, 05.11.2020 04:40
Engineering, 05.11.2020 04:40