Generates a scatter plot of the input data of a
svm fit for
classification models by highlighting the classes and support
vectors. Optionally, draws a filled contour plot of the class regions.
data to visualize. Should be the same used for fitting.
formula
formula selecting the visualized two dimensions. Only
needed if more than two input variables are used.
fill
switch indicating whether a contour plot for the class
regions should be added.
grid
granularity for the contour plot.
slice
a list of named numeric values for the dimensions held
constant (only needed if more than two variables are
used). Dimensions not specified are fixed at 0.
symbolPalette
Color palette used for the class the data points and support
vectors belong to.
svSymbol
Symbol used for support vectors.
dataSymbol
Symbol used for data points (other than support vectors).
...
additional graphics parameters passed to
filled.contour and
plot.
## a simple example
library(MASS)
m <- svm(Sex~., data = cats)
plot(m, cats)
## more than two variables: fix 2 dimensions
m2 <- svm(Species~., data = iris.df)
plot(m2, iris.df, Petal.Width ~ Petal.Length,
slice = list(Sepal.Width = 3, Sepal.Length = 4))