predict.gensvm {gensvm} | R Documentation |
Predict class labels with the GenSVM model
Description
This function predicts the class labels of new data using a fitted GenSVM model.
Usage
## S3 method for class 'gensvm'
predict(object, newdata, add.rownames = FALSE, ...)
Arguments
object |
Fitted |
newdata |
Matrix of new data for which predictions need to be made. |
add.rownames |
add the rownames from the training data to the predictions |
... |
further arguments are ignored |
Value
a vector of class labels, with the same type as the original class labels.
Author(s)
Gerrit J.J. van den Burg, Patrick J.F. Groenen
Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com>
References
Van den Burg, G.J.J. and Groenen, P.J.F. (2016). GenSVM: A Generalized Multiclass Support Vector Machine, Journal of Machine Learning Research, 17(225):1–42. URL https://jmlr.org/papers/v17/14-526.html.
See Also
plot.gensvm
, predict.gensvm.grid
,
gensvm
, gensvm-package
Examples
x <- iris[, -5]
y <- iris[, 5]
# create a training and test sample
attach(gensvm.train.test.split(x, y))
fit <- gensvm(x.train, y.train)
# predict the class labels of the test sample
y.test.pred <- predict(fit, x.test)
# compute the accuracy with gensvm.accuracy
gensvm.accuracy(y.test, y.test.pred)
[Package gensvm version 0.1.7 Index]