set.seed(45)
x <- rbind(
matrix(rnorm(8, -2, 0.2), ncol = 2),
matrix(rnorm(8, 0, 0.2), ncol = 2),
matrix(rnorm(8, 2, 0.2), ncol = 2)
)
y <- factor(rep(c("a", "b", "c"), each = 4))
fit <- svms(x, y, kernel = "linear", max_passes = 2, max_iter = 100)
predict(fit, x[1:3, , drop = FALSE])
Run the code above in your browser using DataLab