I am using kernlab to build svm models. I am not sure how to access the
different slots of the object. For instance if I want to get the nuber of
support vectors for each of model I am building and store it in a vector.
>ksvm.model <- ksvm(Class ~ ., data = somedata,kernel =
"vanilladot", cross = 10, type ="C-svc")
>names(attributes(ksvm.model))
[1] "param" "scaling" "coef"
"alphaindex" "b"
[6] "obj" "SVindex" "nSV"
"prior" "prob.model"
[11] "alpha" "type" "kernelf"
"kpar" "xmatrix"
[16] "ymatrix" "fitted" "lev"
"nclass" "error"
[21] "cross" "n.action" "terms"
"kcall" "class"
>ksvm.model
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C = 1
Linear (vanilla) kernel function.
Number of Support Vectors : 144
Objective Function Value : -4.3162
Training error : 0
Cross validation error : 0.4
In the above dummy example how do I access the number of support vectors?
I tried the following
ksvm.model$nSV
nSV(ksvm.model)
Thanks ../Murli