predict.spectral: Predict function for Spectral clustering

predict.spectralR Documentation

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 class '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

## Not run: 
require (datasets)
data (iris)
d = splitdata (iris, 5)
model = SPECTRAL (d$train.x, k = 3)
predict (model, d$test.x)

## End(Not run)

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.