0

I've built an SVM model and the accuracy is quite good, the only problem is to plot the classification graph (For test data). I tried the way we usually do with the Iris data-set but getting I keep getting an error.

Code that I tried:

m2 <- svm(all~., data = sdfd) 
plot(m2, sdfd, Std.Dev ~ Var)#,

Here sdfd is the dataset in which the first column, all, is the factor of five values(in total 115). After execution of model I got:

Parameters:
   SVM-Type:  C-classification 
 SVM-Kernel:  radial 
       cost:  1 
      gamma:  0.001052632 

Number of Support Vectors:  115

then when I tried to plot the classification chart I got this error:

Code that I tried:

plot(m2, sdfd, Std.Dev ~ Var,
     slice = list(Skew = 3, Kur = 3))# 

here, Skew and Kurt are two columns in my data-set. Though I wanted to plot the classification graph for eight columns together(I have 8 columns in my data), I realize that having eight columns and five factors are not possible to plot(Dimension wise). So I tried to plot pairwise. The error that I am getting is:

Error in Summary.factor(c(103L, 102L, 110L, 84L, 92L, 93L, 94L, 88L, 69L,: ‘min’ not meaningful for factors

What I wanted to plot is similar to this:

data(iris) 
m2 <- svm(Species~., data = iris) 
plot(m2, iris, Petal.Width ~ Petal.Length,
     slice = list(Sepal.Width = 3, Sepal.Length = 6))

It is really very helpful if someone can tell me how can i plot with five factors and 8 columns classification graph, but if someone can suggest me the solution of above error it would be equally helpful too.

divibisan
  • 11,659
  • 11
  • 40
  • 58
Kumar
  • 1
  • 4
  • What exactly do you want the plot to look like? When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. This will make it easier to help you. Clearly list any non-base R packages you are using. – MrFlick Aug 07 '18 at 18:25
  • I've edited my question, similar to iris data-set i want a classification graph for my data-set, if possible suggest me how can i plot eight columns in one classification graph or else how to do it pair-wise – Kumar Aug 07 '18 at 20:35
  • @MrFlick I have made necessary changes in my question can you please help me now or tell me what else is required?? – Kumar Aug 09 '18 at 13:01

0 Answers0