| confusion | R Documentation |
Predicts on x and returns a confusion matrix plus overall accuracy. This
works for both binary and one-vs-one multiclass tsvm and svms fits.
confusion(object, x, y)
object |
A fitted |
x |
Numeric matrix or data frame of predictors. |
y |
True class labels. |
A list with table, a table(truth, predicted) confusion matrix,
and accuracy, the overall classification accuracy.
Other multiclass:
predict.svms_multiclass(),
predict.tsvm_multiclass(),
print.svms_multiclass(),
print.tsvm_multiclass()
set.seed(50)
x <- rbind(
matrix(rnorm(20, -2, 0.2), ncol = 2),
matrix(rnorm(20, 0, 0.2), ncol = 2),
matrix(rnorm(20, 2, 0.2), ncol = 2)
)
y <- factor(rep(c("a", "b", "c"), each = 10))
fit <- tsvm(x, y, kernel = "linear")
confusion(fit, x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.