as.dist.kernelsom: Compute all the distances between prototypes in a fitted...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Computes all the pairwaise distances between the prototypes of a fitted Kernel Self-Organising Map (SOM).

Usage

1
2
3
4
## S3 method for class 'kernelsom'
as.dist(x, FUN = NULL)
## S3 method for class 'kernelsom'
as.matrix(x, ...)

Arguments

x

an object of class "kernelsom"

...

not used

FUN

not used

Details

Contrarily to the prototype.distances function, those methods compute all the pairwise distances between the prototypes of the SOM in the kernel space. This is useful in order to display those prototypes via a nonlinear projection method such the Sammon mapping (sammon).

The distances are computed in the kernel space. If the kernel used to fit the SOM is not positive, negative values may be obtained. When such values are generated, they are replaced by NA.

Value

as.matrix returns a square matrix and as.dist an object of class "dist".

Author(s)

Fabrice Rossi

See Also

prototype.distances for a quite different approach based on path calculation in the prior structure.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(iris)
# scaling
K <- as.kernelmatrix(tcrossprod(scale(iris[1:4])))

# a small hexagonal grid
sg <- somgrid(xdim=8,ydim=8,topo="hex")

# fit the SOM (random initialisation)
som <- batchsom(K,sg,init="random",method="cluster")

# display the prototypes via sammon mapping
library(MASS)
proto.sam <- sammon(as.dist(som))
plot(proto.sam$points)

# overlay the prior structure
lines(grid2lines(som,proto.sam$points))

yasomi documentation built on May 2, 2019, 5:59 p.m.