subject
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

ansver
Answers: 3

Another question on Mathematics

question
Mathematics, 21.06.2019 17:30
Afarmer sells 9.5 kilograms of apples and pears at the farmer's market. 4/5 of the weight is the apples and the rest is the pears. how many kilograms of pears did she sell at the farmers market
Answers: 1
question
Mathematics, 21.06.2019 19:30
Prove the divisibility of the following numbers: 25^9 + 5^7 is divisible by 30.also, read as (25 to the power of 9) + (5 to the power of 7) is divisible by 30. blank x 30what is the blank? ( it should be expressed in exponent form)
Answers: 1
question
Mathematics, 21.06.2019 19:40
Aretha wanted to gather data about the cost of local bowling leagues in her area. she plotted the data and determined that the average bowling league costs consist of a one-time registration fee and a monthly fee modeled by the equation y = 15x + 20. identify and interpret the y-intercept in this model. the y-intercept is 20. this is the cost per month. the y-intercept is 20. this is the cost of registration. the y-intercept is 15. this is the cost of registration. the y-intercept is 15. this is the cost per month.
Answers: 1
question
Mathematics, 22.06.2019 00:00
What is perpendicular to y=-1/2x+11
Answers: 1
You know the right answer?
In this question you will train a spam classifier using support vector machines. We will use the spa...
Questions
question
Mathematics, 03.03.2021 19:20
question
English, 03.03.2021 19:30
question
History, 03.03.2021 19:30
question
Mathematics, 03.03.2021 19:30
question
Computers and Technology, 03.03.2021 19:30
question
Spanish, 03.03.2021 19:30
Questions on the website: 13722366