使用SVM模型绘制多个类别变量

时间:2019-02-26 21:41:38

标签: r svm

数据尺寸为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个以上的分类变量。

0 个答案:

没有答案