How do I decide on the optimal value of cost in SVM in R

svm
r
cost_function

#1

hello,

While trying to understand how the cost affects the performance of an SVM I noticed a few things:
m <- svm(quality_bin ~ ., data = training, cost = 0.1) # here the cost value is 0.1
pred <- predict(m,testing)
confusionMatrix(pred, testing$quality_bin)

For this the output is:

  m <- svm(quality_bin ~ ., data = training, cost = 0.50) # here the cost value is 0.1
    pred <- predict(m,testing)
    confusionMatrix(pred, testing$quality_bin)

here we can see that both the Accuracy and Kappa have increase but when I do:
m <- svm(quality_bin ~ ., data = training, cost = 1) # here the cost value is 0.1
pred <- predict(m,testing)
confusionMatrix(pred, testing$quality_bin)

Here the Accuracy has not increased but Kappa has increased slightly.

So my questions is:
1.If Accuracy is increasing shouldn’t Kappa also increase?
2.How do I decide on the optimal value of cost in SVM?