predict.ksvm | R Documentation |
Prediction of test data using support vector machines
## S4 method for signature 'ksvm'
predict(object, newdata, type = "response", coupler = "minpair")
object |
an S4 object of class |
newdata |
a data frame or matrix containing new data |
type |
one of |
coupler |
Coupling method used in the multiclass case, can be one
of |
If type(object)
is C-svc
,
nu-svc
, C-bsvm
or spoc-svc
the vector returned depends on the argument type
:
response |
predicted classes (the classes with majority vote). |
probabilities |
matrix of class probabilities (one column for each class and one row for each input). |
votes |
matrix of vote counts (one column for each class and one row for each new input) |
If type(object)
is eps-svr
, eps-bsvr
or
nu-svr
a vector of predicted values is returned.
If type(object)
is one-classification
a vector of
logical values is returned.
Alexandros Karatzoglou
alexandros.karatzoglou@ci.tuwien.ac.at
T.F. Wu, C.J. Lin, R.C. Weng.
Probability estimates for Multi-class Classification by
Pairwise Coupling
https://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdf
H.T. Lin, C.J. Lin, R.C. Weng (2007), A note on Platt's probabilistic outputs for support vector machines. Machine Learning, 68, 267–276. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s10994-007-5018-6")}.
## example using the promotergene data set
data(promotergene)
## create test and training set
ind <- sample(1:dim(promotergene)[1],20)
genetrain <- promotergene[-ind, ]
genetest <- promotergene[ind, ]
## train a support vector machine
gene <- ksvm(Class~.,data=genetrain,kernel="rbfdot",
kpar=list(sigma=0.015),C=70,cross=4,prob.model=TRUE)
gene
## predict gene type probabilities on the test set
genetype <- predict(gene,genetest,type="probabilities")
genetype
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.