I am new to ML and R. I have built a image classification model using SVM. Following is the code I used to build this model,
tuned <- tune.svm(label~., data = train, gamma = 10^(-6:-1), cost = 10^(-1:1))
model <- svm(label~., data = train, kernel = 'radial', type = 'C-classification', gamma = 0.001, cost = 10)
prediction <- predict(model, test[,-1])
prediction
tab <- table(pred = prediction, true = test[,1])
tab
Is there a function to calculate the accuracy of the model?
I need to know how to generate something like the below screenshot using R,
Try this (svm with 5-fold cross-validation) to get the desired output (ran with randomly generated data)
with output
and then use the model for prediction on the unseen data