Predict the class of a new observation based on k-NN.
# S3 method for knn3
predict(object, newdata, type = c("prob", "class"), ...)
object of class knn3
.
a data frame of new observations.
return either the predicted class or the proportion of the votes for the winning class.
additional arguments.
Either the predicted class or the proportion of the votes for each class.
This function is a method for the generic function predict
for
class knn3
. For the details see knn3
. This is
essentially a copy of predict.ipredknn
.