Learn R Programming

Rdimtools (version 0.1.2)

do.sammon: Sammon Mapping

Description

do.sammon is an implementation for Sammon mapping, one of the earliest dimension reduction techniques that aims to find low-dimensional embedding that preserves pairwise distance structure in high-dimensional data space.

Usage

do.sammon(X, ndim = 2, preprocess = "null", initialize = "random")

Arguments

X

an (n-by-p) matrix or data frame whose rows are observations and columns represent independent variables.

ndim

an integer-valued target dimension.

preprocess

an additional option for preprocessing the data. Default is "null" and three options of "center", "decorrelate", or "whiten" are supported. See also aux.preprocess for more details.

initialize

"random" or "pca"; the former performs fast random projection (see also do.rndproj) and the latter performs standard PCA (see also do.pca).

Value

a named list containing

Y

an (n-by-ndim) matrix whose rows are embedded observations.

trfinfo

a list containing information for out-of-sample prediction.

References

Sammon, J.W. (1969) A Nonlinear Mapping for Data Structure Analysis. IEEE Transactions on Computers, C-18 5:401-409.

sammon_nonlinear_1969Rdimtools

Examples

Run this code
# NOT RUN {
## generate default dataset
## in order to pass CRAN pretest, n is set to be small.
X <- aux.gensamples(n=28)

## compare two initialization
out1 = do.sammon(X,ndim=2)                   # random projection
out2 = do.sammon(X,ndim=2,initialize="pca")  # pca as initialization

par(mfrow=c(1,2))
plot(out1$Y[,1],out1$Y[,2],main="out1:rndproj")
plot(out2$Y[,1],out2$Y[,2],main="out2:pca")

# }

Run the code above in your browser using DataLab