1. Obtain an SVM model for forecasting the quality of variant with Class 2
library(e1071)
ds <- read.csv("wine.data")
ds_class2 <- ds[ds$Class==2,-1]
m <- svm(Proline ~ ., ds_class2)
2. Split the data set in two parts: one with 70% of the samples and the other with the remaining 30%. Obtain an SVM with the first part and apply it to the second. What was the resulting mean absolute error?
idx <- sample(1:nrow(ds_class2),nrow(ds_class2)*0.7)
tr <- ds_class2[idx,]
ts <- ds_class2[-idx,]
m <- svm(Proline ~ ., tr)
p <- predict(m, ts)
mae <- mean(abs(p - ts$Proline))
mae
## [1] 131.7057