1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
\name{predict.ksvm}
\alias{predict.ksvm}
\alias{predict,ksvm-method}
\title{predict method for support vector object}
\description{Prediction of test data using support vector machines}
\usage{
\S4method{predict}{ksvm}(object, newdata, type = "response", coupler = "minpair")
}
\arguments{
\item{object}{an S4 object of class \code{ksvm} created by the
\code{ksvm} function}
\item{newdata}{a data frame or matrix containing new data}
\item{type}{one of \code{response}, \code{probabilities}
,\code{votes}, \code{decision}
indicating the type of output: predicted values, matrix of class
probabilities, matrix of vote counts, or matrix of decision values.}
\item{coupler}{Coupling method used in the multiclass case, can be one
of \code{minpair} or \code{pkpd} (see reference for more details).}
}
\value{
If \code{type(object)} is \code{C-svc},
\code{nu-svc}, \code{C-bsvm} or \code{spoc-svc}
the vector returned depends on the argument \code{type}:
\item{response}{predicted classes (the classes with majority vote).}
\item{probabilities}{matrix of class probabilities (one column for each class and
one row for each input).}
\item{votes}{matrix of vote counts (one column for each class and one row
for each new input)}
If \code{type(object)} is \code{eps-svr}, \code{eps-bsvr} or
\code{nu-svr} a vector of predicted values is returned.
If \code{type(object)} is \code{one-classification} a vector of
logical values is returned.
}
\references{
\itemize{
\item
T.F. Wu, C.J. Lin, R.C. Weng. \cr
\emph{Probability estimates for Multi-class Classification by
Pairwise Coupling}\cr
\url{https://www.csie.ntu.edu.tw/~cjlin/papers/svmprob/svmprob.pdf}
\item
H.T. Lin, C.J. Lin, R.C. Weng (2007),
A note on Platt's probabilistic outputs for support vector
machines.
\emph{Machine Learning}, \bold{68}, 267--276.
\doi{10.1007/s10994-007-5018-6}.
}
}
\author{Alexandros Karatzoglou\cr
\email{alexandros.karatzoglou@ci.tuwien.ac.at}}
\keyword{methods}
\keyword{regression}
\keyword{classif}
\examples{
## 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
}
|