Learn R Programming

kernlab (version 0.9-27)

ksvm-class: Class "ksvm"

Description

An S4 class containing the output (model) of the ksvm Support Vector Machines function

Arguments

Objects from the Class

Objects can be created by calls of the form new("ksvm", ...) or by calls to the ksvm function.

Slots

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

Methods

SVindex

signature(object = "ksvm"): return the indexes of support vectors

alpha

signature(object = "ksvm"): returns the complete 5 alpha vector (wit zero values)

alphaindex

signature(object = "ksvm"): returns the indexes of non-zero alphas (support vectors)

cross

signature(object = "ksvm"): returns the cross-validation error

error

signature(object = "ksvm"): returns the training error

obj

signature(object = "ksvm"): returns the value of the objective function

fitted

signature(object = "vm"): returns the fitted values (predict on training set)

kernelf

signature(object = "ksvm"): returns the kernel function

kpar

signature(object = "ksvm"): returns the kernel parameters (hyperparameters)

lev

signature(object = "ksvm"): returns the levels in case of classification

prob.model

signature(object="ksvm"): returns class prob. model values

param

signature(object="ksvm"): returns the parameters of the SVM in a list (C, epsilon, nu etc.)

prior

signature(object="ksvm"): returns the prior of the training set

kcall

signature(object="ksvm"): returns the ksvm function call

scaling

signature(object = "ksvm"): returns the scaling values

show

signature(object = "ksvm"): prints the object information

type

signature(object = "ksvm"): returns the problem type

xmatrix

signature(object = "ksvm"): returns the data matrix used

ymatrix

signature(object = "ksvm"): returns the response vector

See Also

ksvm, rvm-class, gausspr-class

Examples

Run this code
# 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