数据尺寸为515行乘26列,第26列包含5个类别变量:Speed1,Speed2,Speed3,Speed4,Speed5,每个变量包含103行/ 5列的数据,合并后变为515行/ 25列
svm_linear.model <- svm(Speeds ~ ., data=S7_tr_S , kernel ="linear",cost=.01)
svm_linear.model
Call:
svm(formula = Speeds ~ ., data = S7_tr_S, kernel = "linear", cost = 0.01)
Parameters:
SVM-Type: C-classification
SVM-Kernel: linear
cost: 0.01
gamma: 0.04
Number of Support Vectors: 370
svm_linear.pred <- predict(svm_linear.model, S7_te_S[,1:25])
plot(svm_linear.model, S7_tr_S$Speeds)
****Error in if (is.null(formula) && ncol(data) == 3)
{ : missing value where TRUE/FALSE needed****
目标是绘制线性支持向量机,但我有3个以上的分类变量。