Learn R Programming

Rdimtools (version 0.1.2)

do.dm: Diffusion Maps

Description

do.dm discovers low-dimensional manifold structure embedded in high-dimensional data space using Diffusion Maps (DM). It exploits diffusion process and distances in data space to find equivalent representations in low-dimensional space.

Usage

do.dm(X, ndim = 2, preprocess = "null", diffscale = 1, timescale = 1,
  threshold = 1e-07)

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.

diffscale

a scaling parameter for diffusion kernel. Default is 1 and should be a positive real number with 0 inclusive.

timescale

a target scale whose value represents behavior of heat kernels at time t. Default is 1 and should be a positive real number >0.

threshold

a numerical threshold for making laplacian sparse. Default is 1e-6.

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.

eigvals

a vector of eigenvalues for Markov transition matrix.

References

nadler_diffusion_2005Rdimtools

coifman_diffusion_2006Rdimtools

Examples

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

## Various combinations of (diffscale, timescale)
out1 <- do.dm(X,ndim=2,diffscale=1,timescale=0.1)
out2 <- do.dm(X,ndim=2,diffscale=5,timescale=0.1)
out3 <- do.dm(X,ndim=2,diffscale=10,timescale=0.1)
out4 <- do.dm(X,ndim=2,diffscale=1,timescale=1)
out5 <- do.dm(X,ndim=2,diffscale=5,timescale=1)
out6 <- do.dm(X,ndim=2,diffscale=10,timescale=1)
out7 <- do.dm(X,ndim=2,diffscale=1,timescale=10)
out8 <- do.dm(X,ndim=2,diffscale=5,timescale=10)
out9 <- do.dm(X,ndim=2,diffscale=10,timescale=10)

## Visualize 9 different combinations
par(mfrow=c(3,3))
plot(out1$Y[,1],out1$Y[,2],main="(diff=1,time=0.1)")
plot(out2$Y[,1],out2$Y[,2],main="(diff=5,time=0.1)")
plot(out3$Y[,1],out3$Y[,2],main="(diff=10,time=0.1)")
plot(out4$Y[,1],out4$Y[,2],main="(diff=1,time=1)")
plot(out5$Y[,1],out5$Y[,2],main="(diff=5,time=1)")
plot(out6$Y[,1],out6$Y[,2],main="(diff=10,time=1)")
plot(out7$Y[,1],out7$Y[,2],main="(diff=1,time=10)")
plot(out8$Y[,1],out8$Y[,2],main="(diff=5,time=10)")
plot(out9$Y[,1],out9$Y[,2],main="(diff=10,time=10)")

# }

Run the code above in your browser using DataLab