Description Usage Arguments Value Examples
View source: R/convert_diag2silhouette.R
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.
1 | diag2silhouette(homology, dimension = 1, p = 2, nseq = 100)
|
homology |
an object of S3 class |
dimension |
dimension of features to be considered (default: 1). |
p |
an exponent for the weight function of form |a-b|^p (default: 2). |
nseq |
grid size for which the landscape function is evaluated. |
a list object of "silhouette"
class containing
an (\code{nseq} \times k) landscape functions.
a length-nseq
vector of domain grid.
dimension of features considered.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # ---------------------------------------------------------------------------
# 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.