Description Usage Arguments Value Author(s) Examples
Decision boundary of the fastknn
classifier.
1 2 | knnDecision(xtr, ytr, xte, yte, k, method = "dist", normalize = NULL,
dpi = 150)
|
xtr |
matrix containing the training instances. If |
ytr |
factor array with the training labels. |
xte |
(optional) Matrix containing the test instances. The test points will be
plotted over the surface boundary. If missing, the training points will be
plotted instead. If |
yte |
(optional) Factor array with the test labels. |
k |
number of neighbors considered. |
method |
method used to infer the class membership probabilities of the
test instances. See |
normalize |
variable scaler as in |
dpi |
a scalar that defines the graph resolution (default = 150).
It means that |
ggplot2
object.
David Pinto.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.