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 19:30
Asurvey of 2,000 doctors showed that an average of 3 out of 5 doctors use brand x aspirin.how many doctors use brand x aspirin
Answers: 1
question
Mathematics, 21.06.2019 22:30
The party planning committee has to determine the number of tables needed for an upcoming event. if a square table can fit 8 people and a round table can fit 6 people, the equation 150 = 8x + 6y represents the number of each type of table needed for 150 people.
Answers: 1
question
Mathematics, 22.06.2019 02:20
There are two major tests of readiness for college: the act and the sat. act scores are reported on a scale from 1 to 36. the distribution of act scores in recent years has been roughly normal with mean µ = 20.9 and standard deviation s = 4.8. sat scores are reported on a scale from 400 to 1600. sat scores have been roughly normal with mean µ = 1026 and standard deviation s = 209. reports on a student's act or sat usually give the percentile as well as the actual score. the percentile is just the cumulative proportion stated as a percent: the percent of all scores that were lower than this one. tanya scores 1260 on the sat. what is her percentile (± 1)?
Answers: 1
question
Mathematics, 22.06.2019 03:00
What percent of $1.00 are a nickel and a dime?
Answers: 3
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, 08.07.2019 07:30
question
Biology, 08.07.2019 07:30
question
Mathematics, 08.07.2019 07:30
question
Social Studies, 08.07.2019 07:30
Questions on the website: 13722362