diag2landscape: Convert Persistence Diagram into Persistence Landscape

Description Usage Arguments Value References Examples

View source: R/convert_diag2landscape.R

Description

Persistence Landscape (PL) is a functional summary of persistent homology that is constructed given a homology object.

Usage

1
diag2landscape(homology, dimension = 1, k = 0, nseq = 1000)

Arguments

homology

an object of S3 class "homology" generated from diagRips or other homology-generating functions.

dimension

dimension of features to be considered (default: 1).

k

the number of top landscape functions to be used (default: 0). When k=0 is set, it gives all relevant landscape functions that are non-zero.

nseq

grid size for which the landscape function is evaluated (default: 1000).

Value

a list object of "landscape" class containing

lambda

an (\code{nseq} \times k) landscape functions.

tseq

a length-nseq vector of domain grid.

dimension

dimension of features considered.

References

Peter Bubenik (2018). “The Persistence Landscape and Some of Its Properties.” arXiv:1810.04963.

Examples

 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
26
# ---------------------------------------------------------------------------
#              Persistence Landscape of 'iris' Dataset
#
# We will extract landscapes of dimensions 0, 1, and 2.
# For each feature, only the top 5 landscape functions are plotted.
# ---------------------------------------------------------------------------
## Prepare 'iris' data
XX = as.matrix(iris[,1:4])

## Compute Persistence Diagram 
pdrips = diagRips(XX, maxdim=2)

## Convert to Landscapes of Each Dimension
land0 <- diag2landscape(pdrips, dimension=0, k=5)
land1 <- diag2landscape(pdrips, dimension=1, k=5)
land2 <- diag2landscape(pdrips, dimension=2, k=5)

## 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")
matplot(land0$tseq, land0$lambda, type="l", lwd=3, main="dimension 0", xlab="t")
matplot(land1$tseq, land1$lambda, type="l", lwd=3, main="dimension 1", xlab="t")
matplot(land2$tseq, land2$lambda, type="l", lwd=3, main="dimension 2", xlab="t")
par(opar)

kyoustat/TDAkit documentation built on Sept. 1, 2021, 7:22 a.m.