Learn R Programming

GrowingSOM (version 0.1.1)

map.gsom: Map data to a supervised or unsupervised gsom object

Description

Map a data matrix onto a trained gsom object.

Usage

## S3 method for class 'gsom' map.gsom(gsom_object, df, retaindata = FALSE, ...)

Arguments

gsom_object
a trained gsom map (either unsupervised, as obtained by train.gsom, or supervised, as returned by train_xy.gsom).
df
Data matrix, with rows corresponding to objects, and columns to the dimensions the gsom object was trained with
retaindata
if set to TRUE a copy of the mapped data (unscaled) will be added to the returned object.
...
not used.

Value

Returns a S3 object of type "gsom" containing:

See Also

train.gsom, predict.gsom

Examples

Run this code
  #Get some data
  data(iris)
  s = sample(1:150, 100)
  train_set = iris[s,1:4]
  test_set = iris[-s,1:4]

  # Create a GSOM Model
  gsom_iris <- train.gsom(train_set, spreadfactor=0.75)

  # Mapping
  mapped_iris <- map.gsom(gsom_iris, test_set)

Run the code above in your browser using DataLab