gknn(x, y, k = 1, l = 0, break.ties = TRUE, use.all = TRUE,
prob = FALSE)
x
.x
) which may be
NA
in the case of doubt (no definite decision), ties, or missing
neighborhood information. The proportions of winning votes are returned as attribute prob
(if option prob
was used).
The options are fashioned after knn
in package
Missing class values are not allowed because that would collide with a missing classification result.
Missing distance values are ignored but with the possible consequence of missing classification results. Note that this depends on the options settings, e.g.
dists
for efficient computation of cross-distances.### extend Rock example
data(Votes)
x <- as.dummy(Votes[-17])
rc <- rockAll(x, n=2, m=100, theta=0.73, predict=FALSE, debug=TRUE)
gc <- gknn(dists(x, rc$y, method="binary"), rc$cl, k=3)
table(gc[rc$s], rc$cl)
Run the code above in your browser using DataLab