[R] extract hyperplan from e1071 model

Luigi Marongiu m@rongiu@luigi @ending from gm@il@com
Thu Dec 20 11:15:58 CET 2018


Dear all,
I am using the package e1071 for modeling SVM. I obtain a model from
the data and I can plot the results; the plot shows the support
vectors (as 'X's) and the shaded areas as it should be.
However, I don't like the plot generated from the model and I would
like instead to have more control upon the plotting; in particular, I
would like to draw the hyperplane on plots I have already made from
the data available.
Is there a way to extract the values that are used to draw the hyperplane?
That is: plot(model) -- where model is obtained from svm() -- draws an
area in blue and one in red based on some values provided by model;
can I get these values so I can plot a line in a pre-existing plot?
Also, it is possible to extract the positions of the support vectors?
The names of the model generated by svm() are:
> names(mod)
 [1] "call"            "type"            "kernel"          "cost"
 [5] "degree"          "gamma"           "coef0"           "nu"
 [9] "epsilon"         "sparse"          "scaled"          "x.scale"
[13] "y.scale"         "nclasses"        "levels"          "tot.nSV"
[17] "nSV"             "labels"          "SV"              "index"
[21] "rho"             "compprob"        "probA"           "probB"
[25] "sigma"           "coefs"           "na.action"       "fitted"
[29] "decision.values" "terms"

Which one should I look at?
Thank you
-- 
Best regards,
Luigi



More information about the R-help mailing list