jeudi 9 février 2017

R support vector machine - support vectors have too many features

Vote count: 0

When I train my SVM the output support vectors have many more features than my input data. In the below example I use a small subset of the data (10 rows of 6 features to predict a binary class) but the support vectors have 13 features!??!. Looking at mysvm$SV it seems to have mangled some of the data with the feature names. How can I fix this? Thanks

library(e1071)

A10 <- c("t","t","f","f","t","f","f","f","t","t")
A11 <- c(1,12,0,0,1,0,0,0,3,6)
A12 <- c("f","t","f","t","f","f","f","f","t","f")
A13 <- c("g","g","s","g","g","g","s","g","g","g")
A14 <- c("00202","00129","00080","00000","00232","00360","00080","00076","00312","00000")
A15 <- c(0,3,0,0,100,0,0,0,150,200)
Class <- c("+","-","-","-","+","-","-","-","+","-")
df <- data.frame(A10, A11, A12, A13, A14, A15, Class)

mysvm <- svm(df$Class ~ ., data = df)

print(ncol(mysvm$SV))

asked 21 secs ago

Let's block ads! (Why?)



R support vector machine - support vectors have too many features

Aucun commentaire:

Enregistrer un commentaire