Learn R Programming

fdm2id (version 0.9.5)

predict.kmeans: Predict function for K-means

Description

Return the closest K-means cluster for a new dataset.

Usage

# S3 method for kmeans
predict(object, newdata, ...)

Arguments

object

The classification model (created by KMEANS).

newdata

A new dataset (a data.frame), with same variables as the learning dataset.

...

Other parameters.

See Also

KMEANS

Examples

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

Run the code above in your browser using DataLab