Decision boundary of the fastknn
classifier.
knnDecision(xtr, ytr, xte, yte, k, method = "dist", normalize = NULL, dpi = 150)
xtr
is not a
bidimensional matrix only the first two columns will be considered.xte
is not a bidimensional matrix only the first
two columns will be considered.fastknn
for more details.fastknn
.dpi^2
data points will be generated from the original
dataset to draw the decision boundary. So, for large values (>= 300) it may
take too much time to plot.ggplot2
object.
## Not run: ------------------------------------ # library("caTools") # library("fastknn") # # data("spirals") # # x <- data.matrix(spirals$x) # y <- spirals$y # # set.seed(2048) # tr.idx <- which(sample.split(Y = y, SplitRatio = 0.7)) # x.tr <- x[tr.idx,] # x.te <- x[-tr.idx,] # y.tr <- y[tr.idx] # y.te <- y[-tr.idx] # # knnDecision(xtr = x.tr, ytr = y.tr, xte = x.te, yte = y.te, k = 10) ## ---------------------------------------------