predict.knn {knnTree}R Documentation

Predict using a knn object

Description

Predict class labels from a knn object and some data

Usage

predict.knn (object, test, train, theyre.the.same = FALSE,
return.classifications = FALSE, verbose=0, ...)

Arguments

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

Details

This uses a knn object created by R{knn.var} to make predictions on some data.

Value

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.

Author(s)

Sam Buttrey buttrey@nps.navy.mil

References

Buttrey and Karo, 2002

See Also

link{knn.var}, knnTree


[Package knnTree version 1.2.4 Index]