| tsvm | R Documentation |
Fits a twin support vector machine. With two classes this uses the validated
binary twin-SVM path: level 1 of y is class B, level 2 is class A, plane 1
is close to class A, and plane 2 is close to class B. With three or more
classes, the function fits one binary twin SVM for each class pair and
predicts by majority vote. Multiclass ties are resolved by choosing the class
that appears first in the factor level order.
tsvm(
x,
y,
method = c("ls", "twin"),
kernel = c("linear", "rbf", "poly"),
c1 = 1,
c2 = 1,
gamma = NULL,
degree = 3,
coef0 = 1,
eps = 1e-06
)
x |
Numeric matrix or data frame of predictors. |
y |
Response with at least two classes. |
method |
Twin-SVM method. |
kernel |
Kernel name. |
c1, c2 |
Positive regularization parameters. |
gamma |
Kernel scale. Defaults to |
degree |
Polynomial degree. |
coef0 |
Polynomial offset. |
eps |
Ridge term added to every linear solve. |
A fitted tsvm object for two classes, or a tsvm_multiclass object
for three or more classes.
Jayadeva, Khemchandani, R., and Chandra, S. (2007). Twin support vector machines for pattern classification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 29(5), 905-910.
Kumar, M. A. and Gopal, M. (2009). Least squares twin support vector machines for pattern classification. Expert Systems with Applications, 36(4), 7535-7543.
set.seed(3)
dat <- gen_moons(50, noise = 0.05)
fit <- tsvm(dat$x, dat$y)
predict(fit, dat$x[1:4, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.