Hi there I am currently in the process of running at SVM data analysis and have got stuck with my SVM model:
library(caTools)
set.seed(123)
split<-sample.split(ult, SplitRatio = 0.8)
training_set<-subset(ult, split == 1)
ult$dns<-factor(ult$dns, labels = make.names(levels(ult$dns)))
str(ult)
test_set<-subset(ult, split == 0)
trainX <-data.frame(training_set)
str(training_set)
svm.model.ult <- svm(dns ~ ., data = trainX, type = "C-classification", cost = 1,gamma = 0.125, cross =10)
svm.pred.ult <- predict(svm.model.ult, test_set[,-7])
table(pred = svm.pred.ult, true = test_set[,7]
My code has been running fine until the last two steps (svm.pred.ult
and table
) as it returns a table with true and pred values but the pred values are only 0 so the table does not look right and code further on does not work.