Learn R Programming

fdm2id (version 1.0.1)

predict.pam: Predict function for PAM

Description

Returns the cluster of the closest medoid, for a new dataset.

Usage

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

Value

A vector of cluster numbers.

Arguments

object

The clustering (created by PAM).

newdata

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

...

Other parameters.

See Also

PAM, predict.kmeans

Examples

Run this code
require (datasets)
data (iris)
d = splitdata (iris, 5)
model = PAM (d$train.x, 3)
table (predict (model, d$test.x), d$test.y)

Run the code above in your browser using DataLab