diag2silhouette {TDAkit} | R Documentation |
Convert Persistence Diagram into Persistent Silhouette
Description
Persistence Silhouette (PS) is a functional summary of persistent homology
that is constructed given a homology
object. PS is a weighted average of
landscape functions so that it becomes a uni-dimensional function.
Usage
diag2silhouette(homology, dimension = 1, p = 2, nseq = 100)
Arguments
homology |
an object of S3 class |
dimension |
dimension of features to be considered (default: 1). |
p |
an exponent for the weight function of form |
nseq |
grid size for which the landscape function is evaluated. |
Value
a list object of "silhouette"
class containing
- lambda
an
(\code{nseq} \times k)
landscape functions.- tseq
a length-
nseq
vector of domain grid.- dimension
dimension of features considered.
Examples
# ---------------------------------------------------------------------------
# Persistence Silhouette of 'iris' Dataset
#
# We will extract silhouettes of dimensions 0, 1, and 2.
# ---------------------------------------------------------------------------
## Prepare 'iris' data
XX = as.matrix(iris[,1:4])
## Compute Persistence Diagram
pdrips = diagRips(XX, maxdim=2)
## Convert to Silhouettes of Each Dimension
sil0 <- diag2silhouette(pdrips, dimension=0)
sil1 <- diag2silhouette(pdrips, dimension=1)
sil2 <- diag2silhouette(pdrips, dimension=2)
## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2))
plot(pdrips$Birth, pdrips$Death, col=as.factor(pdrips$Dimension),
pch=19, main="persistence diagram", xlab="Birth", ylab="Death")
plot(sil0$tseq, sil0$lambda, type="l", lwd=3, main="dimension 0", xlab="t")
plot(sil1$tseq, sil1$lambda, type="l", lwd=3, main="dimension 1", xlab="t")
plot(sil2$tseq, sil2$lambda, type="l", lwd=3, main="dimension 2", xlab="t")
par(opar)
[Package TDAkit version 0.1.2 Index]