Learn R Programming

fdm2id (version 1.0.1)

predict.som: Predict function for a self-organising map

Description

Returns the cluster of the closest unit of the map, for a new dataset.

Usage

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

Value

A vector of cluster numbers.

Arguments

object

The map (created by SOM).

newdata

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

...

Other parameters.

See Also

SOM, plot.som

Examples

Run this code
# \donttest{
require (datasets)
data (iris)
d = splitdata (iris, 5)
model = SOM (d$train.x, 4, 4)
table (predict (model, d$test.x), d$test.y)
# }

Run the code above in your browser using DataLab