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 17:00
Select all of the quadrants that the parabola whose equation is y=√x-4 (principal square root) occupies. i ii iii iv
Answers: 3
Mathematics, 21.06.2019 17:30
What number should be added to the expression x^2+3x+ in order to create a perfect square trinomial? 3/2 3 9/4 9
Answers: 1
Mathematics, 21.06.2019 23:30
Adele is five years older than timothy. in three years, timothy will be 2/3 of adele’s age. what is adele‘s current age?
Answers: 1
In this question you will train a spam classifier using support vector machines. We will use the spa...
Mathematics, 26.02.2020 03:55
Mathematics, 26.02.2020 03:55
Mathematics, 26.02.2020 03:56
Mathematics, 26.02.2020 03:56
Mathematics, 26.02.2020 03:56
Mathematics, 26.02.2020 03:56