Learn R Programming

fdm2id (version 1.0.1)

predict.spectral: Predict function for Spectral clustering

Description

Return the closest Spectral clustering cluster for a new dataset. New instances are assigned to the cluster of their nearest neighbour in the original (training) space, since the spectral projection cannot be directly extended to unseen data without recomputing the affinity matrix.

Usage

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

Arguments

object

The clustering model (of class spectral-class, created by SPECTRAL).

newdata

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

...

Other parameters.

See Also

SPECTRAL, spectral-class

Examples

Run this code
if (FALSE) {
require (datasets)
data (iris)
d = splitdata (iris, 5)
model = SPECTRAL (d$train.x, k = 3)
predict (model, d$test.x)
}

Run the code above in your browser using DataLab