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 15:50
Do a swot analysis for the business idea you chose in question 2 above. describe at least 2 strengths, 2 weaknesses, 2 opportunities, and 2 threats for that company idea. (1-8 sentences. 4.0 points)
Answers: 1
question
Mathematics, 21.06.2019 20:00
Write the point-slope form of the line passing through (2, -12) and parallel to y=3x.
Answers: 3
question
Mathematics, 21.06.2019 21:00
From the beginning of the day the temperature rose 15 degrees so that by 4 pm it was 87 degrees. what was the temperature at the start of the day
Answers: 1
question
Mathematics, 21.06.2019 22:00
After a dreary day of rain, the sun peeks through the clouds and a rainbow forms. you notice the rainbow is the shape of a parabola. the equation for this parabola is y = -x2 + 36. graph of a parabola opening down at the vertex 0 comma 36 crossing the x–axis at negative 6 comma 0 and 6 comma 0. in the distance, an airplane is taking off. as it ascends during take-off, it makes a slanted line that cuts through the rainbow at two points. create a table of at least four values for the function that includes two points of intersection between the airplane and the rainbow. analyze the two functions. answer the following reflection questions in complete sentences. what is the domain and range of the rainbow? explain what the domain and range represent. do all of the values make sense in this situation? why or why not? what are the x- and y-intercepts of the rainbow? explain what each intercept represents. is the linear function you created with your table positive or negative? explain. what are the solutions or solution to the system of equations created? explain what it or they represent. create your own piecewise function with at least two functions. explain, using complete sentences, the steps for graphing the function. graph the function by hand or using a graphing software of your choice (remember to submit the graph).
Answers: 2
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, 18.10.2021 17:00
question
Health, 18.10.2021 17:00