predict.knn {knnTree} | R Documentation |
Predict class labels from a knn object and some data
predict.knn (object, test, train, theyre.the.same = FALSE, return.classifications = FALSE, verbose=0, ...)
object |
knn model created by R{knn.var} |
test |
data frame or matrix of test data with classifications in column 1. |
train |
data frame or matrix of training data with classifications in column 1 |
theyre.the.same |
logical describing whether train and test are the same data set. If so, train is ignored. |
return.classifications |
logical: if TRUE, classifications for each element in the test set are returned. |
verbose |
numeric for debugging purposes. If verbose is 0, no
diagnostic output is produced. If verbose > 0, diagnostic output (more
as the value increases) is placed in a file called "status.txt" in
the HOME directory. When verbose is 2 or (especially) 3 this file
may become very large. |
... |
Other arguments, currently ignored |
This uses a knn object created by R{knn.var} to make predictions on some data.
List with a component named "rate" giving test set error rate. If return.classifications = TRUE, a second item named classifications is a vector with the classification of each item in the test set.
Sam Buttrey buttrey@nps.navy.mil
Buttrey and Karo, 2002
link{knn.var}
, knnTree