predict.knn: Model predictions

predict.knnR Documentation

Model predictions

Description

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

Usage

## S3 method for class '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

require (datasets)
data (iris)
d = splitdata (iris, 5)
model = KNN (d$train.x, d$train.y)
predict (model, d$test.x)

fdm2id documentation built on July 9, 2023, 6:05 p.m.

Related to predict.knn in fdm2id...