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.