Learn R Programming

Rdimtools (version 1.0.6)

do.phate: Potential of Heat Diffusion for Affinity-based Transition Embedding

Description

PHATE is a nonlinear method that is specifically targeted at visualizing high-dimensional data by embedding it on 2- or 3-dimensional space. We offer a native implementation of PHATE solely in R/C++ without interface to python module.

Usage

do.phate(
  X,
  ndim = 2,
  k = 5,
  alpha = 10,
  dtype = c("log", "sqrt"),
  smacof = TRUE,
  maxiter = 100,
  abstol = 1e-06
)

Arguments

X

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

ndim

an integer-valued target dimension (default: 2).

k

size of nearest neighborhood (default: 5).

alpha

decay parameter for Gaussian kernel exponent (default: 10).

dtype

type of potential distance transformation; "log" or "sqrt".

smacof

a logical; TRUE to use SMACOF for Metric MDS (default), or FALSE to use Classical MDS.

maxiter

maximum number of iterations for metric MDS updates (default: 100).

abstol

stopping criterion for metric MDS iterations (default: 1e-6).

Value

a named list containing

Y

an \((n\times ndim)\) matrix whose rows are embedded observations.

trfinfo

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

References

moon_visualizing_2019Rdimtools

Examples

Run this code
# NOT RUN {
## load iris data
data(iris)
X     = as.matrix(iris[,1:4])
lab   = as.factor(iris[,5])

## compare two potential distances with PCA
pca2d <- do.pca(X, ndim=2)
phlog <- do.phate(X, ndim=2, dtype="log")
phsqt <- do.phate(X, ndim=2, dtype="sqrt")

## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(pca2d$Y, col=lab, pch=19, main="PCA")
plot(phlog$Y, col=lab, pch=19, main="log potential")
plot(phsqt$Y, col=lab, pch=19, main="sqrt potential")
par(opar)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab