An S4 class containing the output (model) of the
ksvm
Support Vector Machines function
Objects can be created by calls of the form new("ksvm", ...)
or by calls to the ksvm
function.
type
:Object of class "character"
containing
the support vector machine type
("C-svc", "nu-svc", "C-bsvc", "spoc-svc",
"one-svc", "eps-svr", "nu-svr", "eps-bsvr")
param
:Object of class "list"
containing the
Support Vector Machine parameters (C, nu, epsilon)
kernelf
:Object of class "function"
containing
the kernel function
kpar
:Object of class "list"
containing the
kernel function parameters (hyperparameters)
kcall
:Object of class "ANY"
containing the ksvm
function call
scaling
:Object of class "ANY"
containing the
scaling information performed on the data
terms
:Object of class "ANY"
containing the
terms representation of the symbolic model used (when using a formula)
xmatrix
:Object of class "input"
("list"
for multiclass problems
or "matrix"
for binary classification and regression
problems) containing the support vectors calculated from
the data matrix used during computations (possibly scaled and
without NA). In the case of multi-class classification each list
entry contains the support vectors from each binary classification
problem from the one-against-one method.
ymatrix
:Object of class "output"
the response "matrix"
or "factor"
or "vector"
or
"logical"
fitted
:Object of class "output"
with the fitted values,
predictions using the training set.
lev
:Object of class "vector"
with the levels of the
response (in the case of classification)
prob.model
:Object of class "list"
with the
class prob. model
prior
:Object of class "list"
with the
prior of the training set
nclass
:Object of class "numeric"
containing
the number of classes (in the case of classification)
alpha
:Object of class "listI"
containing the
resulting alpha vector ("list"
or "matrix"
in case of multiclass classification) (support vectors)
coef
:Object of class "ANY"
containing the
resulting coefficients
alphaindex
:Object of class "list"
containing
b
:Object of class "numeric"
containing the
resulting offset
SVindex
:Object of class "vector"
containing
the indexes of the support vectors
nSV
:Object of class "numeric"
containing the
number of support vectors
obj
:Object of class vector
containing the value of the objective function. When using
one-against-one in multiclass classification this is a vector.
error
:Object of class "numeric"
containing the
training error
cross
:Object of class "numeric"
containing the
cross-validation error
n.action
:Object of class "ANY"
containing the
action performed for NA
signature(object = "ksvm")
: return the indexes
of support vectors
signature(object = "ksvm")
: returns the complete
5 alpha vector (wit zero values)
signature(object = "ksvm")
: returns the
indexes of non-zero alphas (support vectors)
signature(object = "ksvm")
: returns the
cross-validation error
signature(object = "ksvm")
: returns the training
error
signature(object = "ksvm")
: returns the value of the objective function
signature(object = "vm")
: returns the fitted
values (predict on training set)
signature(object = "ksvm")
: returns the kernel
function
signature(object = "ksvm")
: returns the kernel
parameters (hyperparameters)
signature(object = "ksvm")
: returns the levels in
case of classification
signature(object="ksvm")
: returns class
prob. model values
signature(object="ksvm")
: returns
the parameters of the SVM in a list (C, epsilon, nu etc.)
signature(object="ksvm")
: returns
the prior of the training set
signature(object="ksvm")
: returns the
ksvm
function call
signature(object = "ksvm")
: returns the
scaling values
signature(object = "ksvm")
: prints the object information
signature(object = "ksvm")
: returns the problem type
signature(object = "ksvm")
: returns the data
matrix used
signature(object = "ksvm")
: returns the
response vector
# NOT RUN {
## simple example using the promotergene data set
data(promotergene)
## train a support vector machine
gene <- ksvm(Class~.,data=promotergene,kernel="rbfdot",
kpar=list(sigma=0.015),C=50,cross=4)
gene
# the kernel function
kernelf(gene)
# the alpha values
alpha(gene)
# the coefficients
coef(gene)
# the fitted values
fitted(gene)
# the cross validation error
cross(gene)
# }
Run the code above in your browser using DataLab