当我训练SVM时,输出支持向量具有比输入数据更多的功能。在下面的例子中,我使用了一小部分数据(10行6个特征来预测二进制类),但支持向量有13个特征:
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))
查看上面的mysvm$SV
,它似乎已经破坏了一些带有功能名称的数据。我怎样才能解决这个问题?感谢