Learn R Programming

Rdimtools (version 1.1.2)

do.hydra: Hyperbolic Distance Recovery and Approximation

Description

Hyperbolic Distance Recovery and Approximation, also known as hydra in short, implements embedding of distance-based data into hyperbolic space represented as the Poincare disk, which is interior of a hypersphere.

Usage

do.hydra(X, ndim = 2, ...)

Value

a named Rdimtools S3 object containing

Y

an \((n\times ndim)\) matrix whose rows are embedded observations in the Poincare disk.

algorithm

name of the algorithm.

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).

...

extra parameters including

kappa

embedding curvature, which is a nonnegative number (default: 1).

iso.adjust

perform isotropic adjustment. If ndim=2, default is FALSE. Otherwise, TRUE is used as default.

References

keller-ressel_2020_HydraMethodStrainminimizingRdimtools

Examples

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

## multiple runs with varying curvatures
embed1 <- do.hydra(X, kappa=0.1)
embed2 <- do.hydra(X, kappa=1)
embed3 <- do.hydra(X, kappa=10)

## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3), pty="s")
plot(embed1$Y , col=lab, pch=19, main="kappa=0.1")
plot(embed2$Y , col=lab, pch=19, main="kappa=1")
plot(embed3$Y , col=lab, pch=19, main="kappa=10")
par(opar)
# }

Run the code above in your browser using DataLab