Learn R Programming

SOMbrero (version 1.2-4)

protoDist: Compute distances between prototypes

Description

Compute distances, either between all prototypes (mode="complete") or only between prototypes' neighbours (mode="neighbors").

Usage

# S3 method for somRes
protoDist(object, mode=c("complete","neighbors"), ...)

Arguments

object

a somRes object.

mode

Specifies which distances should be computed.

...

Not used.

Value

When mode="complete", the function returns a square matrix which dimensions are equal to the product of the grid dimensions.

When mode="neighbors", the function returns a list which length is equal to the product of the grid dimensions; the length of each item is equal to the number of neighbors. Neurons are considered to have 8 neighbors at most (i.e., two neurons are neighbors if they have a distance of type 'maximum' which is equal to 1).

Details

When mode="complete", distances between all prototypes are computed. When mode="neighbors", distances are computed only between the prototypes and their neighbors. If the data were preprocessed during the SOM training procedure, the distances are computed on the normalized values of the prototypes.

See Also

trainSOM

Examples

Run this code
# NOT RUN {
set.seed(2343)
my.som <- trainSOM(x.data=iris[,1:4], dimension=c(5,5))
protoDist(my.som)
# }

Run the code above in your browser using DataLab