Learn R Programming

fdm2id (version 0.9.5)

predict.knn: Model predictions

Description

This function predicts values based upon a model trained by KNN.

Usage

# S3 method for knn
predict(object, test, fuzzy = FALSE, ...)

Arguments

object

The classification model (of class knn).

test

The test set (a data.frame).

fuzzy

A boolean indicating whether fuzzy classification is used or not.

...

Other parameters.

Value

A vector of predicted values (factor).

See Also

KNN, knn-class

Examples

Run this code
# NOT RUN {
require (datasets)
data (iris)
d = splitdata (iris, 5)
model = KNN (d$train.x, d$train.y)
predict (model, d$test.x)
# }

Run the code above in your browser using DataLab