computeBettiCurve: A Vector Summary of the Betti Curve

View source: R/RcppExports.R

computeBettiCurveR Documentation

A Vector Summary of the Betti Curve

Description

For a given persistence diagram D={(b_i,d_i)}_{i=1}^N (corresponding to a specified homological dimension), computeBettiCurve() vectorizes the Betti curve

\beta(t)=\sum_{i=1}^N\bold 1_{[b_i,d_i)}(t)

based on a scale sequence scaleSeq. The evaluation method depends on the argument evaluate.

Usage

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

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

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.

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 Betti curve over intervals defined by consecutive elements in scaleSeq:

    \Big(\frac{1}{\Delta t_1}\int_{t_1}^{t_2}\beta(t)dt,\frac{1}{\Delta t_2}\int_{t_2}^{t_3}\beta(t)dt,\ldots,\frac{1}{\Delta t_{n-1}}\int_{t_{n-1}}^{t_n}\beta(t)dt\Big)\in\mathbb{R}^{n-1},

    where \Delta t_k=t_{k+1}-t_k.

  • "points": Computes values of the Betti curve at each point in scaleSeq:

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

Author(s)

Umar Islambekov, Hasani Pathirana

References

1. Chazal, F., & Michel, B. (2021). An Introduction to Topological Data Analysis: Fundamental and Practical Aspects for Data Scientists. Frontiers in Artificial Intelligence, 108.

2. Chung, Y. M., & Lawson, A. (2022). Persistence curves: A canonical framework for summarizing persistence diagrams. Advances in Computational Mathematics, 48(1), 1-42.

3. Islambekov, U., & Pathirana. H. (2024). Vector Summaries of Persistence Diagrams for Permutation-based Hypothesis Testing. Foundations of Data Science 6 (1), 41-61.

Examples

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 Betti curve for homological dimension H_0
computeBettiCurve(D, homDim = 0, scaleSeq)

# Compute a vector summary of the Betti curve for homological dimension H_1
computeBettiCurve(D, homDim = 1, scaleSeq)

TDAvec documentation built on April 4, 2025, 1:37 a.m.