Learn R Programming

TDAvec (version 0.1.41)

computePersistentEntropy: A Vector Summary of the Persistent Entropy Summary Function

Description

For a given persistence diagram \(D={(b_i,d_i)}_{i=1}^N\) (corresponding to a specified homological dimension), computePersistentEntropy() vectorizes the persistent entropy summary function $$S(t)=-\sum_{i=1}^N \frac{l_i}{L}\log_2{(\frac{l_i}{L}})\bold 1_{[b_i,d_i]}(t),$$ where \(l_i=d_i-b_i\) and \(L=\sum_{i=1}^Nl_i\), based on a scale sequence scaleSeq. If \(N=1\), \(L\) is set to 1. The evaluation method depends on the argument evaluate. Points in \(D\) with infinite death values are ignored.

Usage

computePersistentEntropy(D, homDim, scaleSeq, evaluate = "intervals")

Value

A numeric vector containing elements computed using scaleSeq=\(\{t_1,t_2,\ldots,t_n\}\) according to the method specified by evaluate.

  • "intervals": Computes average values of the persistent entropy summary function over intervals defined by consecutive elements in scaleSeq:

    $$\Big(\frac{1}{\Delta t_1}\int_{t_1}^{t_2}S(t)dt,\frac{1}{\Delta t_2}\int_{t_2}^{t_3}S(t)dt,\ldots,\frac{1}{\Delta t_{n-1}}\int_{t_{n-1}}^{t_n}S(t)dt\Big)\in\mathbb{R}^{n-1},$$ where \(\Delta t_k=t_{k+1}-t_k\).

  • "points": Computes values of the persistent entropy summary function at each point in scaleSeq:

    $$(S(t_1),S(t_2),\ldots,S(t_n))\in\mathbb{R}^n.$$

Arguments

D

a persistence diagram: a matrix with three columns containing the homological dimension, birth and death values respectively.

homDim

the homological dimension (0 for \(H_0\), 1 for \(H_1\), etc.). Rows in D are filtered based on this value.

scaleSeq

a numeric vector of increasing scale values used for vectorization.

evaluate

a character string indicating the evaluation method. Must be either "intervals" (default) or "points".

Author

Umar Islambekov

Details

The function extracts rows from D where the first column equals homDim, and computes values based on the filtered data and scaleSeq. If D does not contain any points corresponding to homDim, a vector of zeros is returned.

References

1. Atienza, N., Gonzalez-Díaz, R., & Soriano-Trigueros, M. (2020). On the stability of persistent entropy and new summary functions for topological data analysis. Pattern Recognition, 107, 107509.

Examples

Run this code
N <- 100 # The number of points to sample

set.seed(123) # Set a random seed for reproducibility

# Sample N points uniformly from the unit circle and add Gaussian noise
theta <- runif(N, min = 0, max = 2 * pi)
X <- cbind(cos(theta), sin(theta)) + rnorm(2 * N, mean = 0, sd = 0.2)

# Compute the persistence diagram using the Rips filtration built on top of X
# The 'threshold' parameter specifies the maximum distance for building simplices
D <- TDAstats::calculate_homology(X, threshold = 2)

scaleSeq = seq(0, 2, length.out = 11) # A sequence of scale values

# Compute a vector summary of the persistent entropy summary function for homological dimension H_0
computePersistentEntropy(D, homDim = 0, scaleSeq)

# Compute a vector summary of the persistent entropy summary function for homological dimension H_1
computePersistentEntropy(D, homDim = 1, scaleSeq)

Run the code above in your browser using DataLab