# predict.ksvm

##### predict method for support vector object

Prediction of test data using support vector machines

- Keywords
- methods, regression, classif

##### Usage

```
# S4 method for ksvm
predict(object, newdata, type = "response", coupler = "minpair")
```

##### Arguments

- object
an S4 object of class

`ksvm`

created by the`ksvm`

function- newdata
a data frame or matrix containing new data

- type
one of

`response`

,`probabilities`

,`votes`

,`decision`

indicating the type of output: predicted values, matrix of class probabilities, matrix of vote counts, or matrix of decision values.- coupler
Coupling method used in the multiclass case, can be one of

`minpair`

or`pkpd`

(see reference for more details).

##### Value

If `type(object)`

is `C-svc`

,
`nu-svc`

, `C-bsvm`

or `spoc-svc`

the vector returned depends on the argument `type`

:

predicted classes (the classes with majority vote).

matrix of class probabilities (one column for each class and one row for each input).

matrix of vote counts (one column for each class and one row for each new input)

##### References

T.F. Wu, C.J. Lin, R.C. Weng.

*Probability estimates for Multi-class Classification by Pairwise Coupling*http://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdfH.T. Lin, C.J. Lin, R.C. Weng

*A note on Platt's probabilistic outputs for support vector machines*http://www.csie.ntu.edu.tw/~cjlin/papers/plattprob.pdf

##### Examples

```
# NOT RUN {
## 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
# }
```

*Documentation reproduced from package kernlab, version 0.9-27, License:*