| predict.svms_multiclass | R Documentation |
Predicts from a one-vs-one multiclass standard SVM. Each binary model votes for one class. Ties are resolved deterministically by choosing the class that appears first in the training factor level order.
## S3 method for class 'svms_multiclass'
predict(object, newdata, type = c("class", "votes"), ...)
object |
A fitted |
newdata |
Numeric matrix or data frame. |
type |
Output type. |
... |
Unused. |
A factor of predicted classes, or an integer vote matrix when
type = "votes".
Other multiclass:
confusion(),
predict.tsvm_multiclass(),
print.svms_multiclass(),
print.tsvm_multiclass()
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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.