So I am training a linear support vector machine on my dataset using lssvm
function from kernlab
package. I get this error that I don't understand:
Error in G[(kadv + 1):n, 1:kadv - 1, drop = FALSE] :
subscript out of bounds
I can't seem to find anything similar online and I don't know how to access the code. The weird thing is that my dataset is very simple. 12 columns, one of which is a Status factor variable with two levels. I tried with iris
dataset and it works, so I don't know if this is related to some property of my table or to the mathematics behind SVM. Any indication is appreciated.
MRE
library(kernlab)
train=structure(list(A = structure(c("0.33", "0.38", "0.35", "0.28",
"0.34", "0.37", "0.32", "0.34", "0.34", "0.34"), class = "AsIs"),
B = structure(c("0.11", "0.14", "0.14", "0.04", "0.08", "0.09",
"0.12", "0.12", "0.10", "0.08"), class = "AsIs"), C = structure(c("0.71",
"0.47", "0.50", "0.28", "0.41", "0.41", "0.55", "0.43", "0.31",
"0.59"), class = "AsIs"), D = structure(c("0.61", "0.54",
"0.75", "0.65", "0.71", "0.76", "0.78", "0.58", "0.72", "0.64"
), class = "AsIs"), E = structure(c("0.55", "0.56", "0.44",
"0.72", "0.71", "0.72", "0.75", "0.42", "0.69", "0.63"), class = "AsIs"),
F = structure(c("0.70", "0.54", "0.73", "0.56", "0.73", "0.80",
"0.28", "0.55", "0.55", "0.68"), class = "AsIs"), G = structure(c("0.41",
"0.24", "0.46", "0.13", "0.48", "0.46", "0.12", "0.28", "0.21",
"0.47"), class = "AsIs"), H = structure(c("0.66", "0.72",
"0.71", "0.72", "0.72", "0.72", "0.71", "0.73", "0.76", "0.60"
), class = "AsIs"), I = structure(c("0.52", "0.40", "0.59",
"0.64", "0.50", "0.61", "0.72", "0.48", "0.52", "0.63"), class = "AsIs"),
J = structure(c("0.37", "0.28", "0.31", "0.30", "0.33", "0.39",
"0.37", "0.46", "0.32", "0.30"), class = "AsIs"), K = structure(c("0.34",
"0.59", "0.31", "0.14", "0.39", "0.18", "0.15", "0.51", "0.40",
"0.24"), class = "AsIs"), Status = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L), levels = c("Y", "N"), class = "factor")), row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10"), class = "data.frame")
lsvm_iris=lssvm(Species~.,data=iris) # works
lsvm_mydata=lssvm(Status~.,data=train) # Weird error