I am in need of a package that can give me the equation for a linear SVM model. Currently I'm using e1071 like so:
library(e1071)
m = svm(data, labels, type='C', kernel='linear', cost=cost, probability=FALSE, scale=scale)
w = t(m$coefs) %*% data[m$index,] #Weight vector
b = -model$rho #Offset
However, I'm not sure how e1071::svm()
selects positive and negative classes, so I think this might screw up with different data sets. Can anyone confirm how this function decides which class is positive and which one is negative?
Also, is there a better package for this?
svm_linear
in thetidymodels
package. $\endgroup$