Skip to contents

Computes Betti curves from persistence diagrams. There are several modes of operation: with a given resolution (with or without a sample_range), with a predefined grid, and with none of the previous. With a predefined grid, the class computes the Betti numbers at those grid points. Without a predefined grid, if the resolution is set to NULL, it can be fit to a list of persistence diagrams and produce a grid that consists of (at least) the filtration values at which at least one of those persistence diagrams changes Betti numbers, and then compute the Betti numbers at those grid points. In the latter mode, the exact Betti curve is computed for the entire real line. Otherwise, if the resolution is given, the Betti curve is obtained by sampling evenly using either the given sample_range or based on the persistence diagrams.

Author

Mathieu Carrière

Super classes

rgudhi::PythonClass -> rgudhi::SKLearnClass -> rgudhi::VectorRepresentationStep -> BettiCurve

Methods

Inherited methods


Method new()

The BettiCurve constructor.

Usage

BettiCurve$new(
  resolution = 100,
  sample_range = rep(NA_real_, 2),
  predefined_grid = NULL
)

Arguments

resolution

An integer value specifying the number of sample for the piecewise constant function. Defaults to 100L.

sample_range

A length-2 numeric vector specifying the minimum and maximum of the piecewise constant function domain, of the form \([x_{\min}, x_{\max}]\). Defaults to rep(NA, 2). It is the interval on which samples will be drawn evenly. If one of the values is NA, it can be computed from the persistence diagrams with the $fit() method.

predefined_grid

A numeric vector specifying a predefined grid of points at which to compute the Betti curves. Must be strictly ordered. Infinities are ok. If set to NULL (default), and resolution is given, the grid will be uniform from \(x_{\min}\) to \(x_{\max}\) in resolution steps, otherwise a grid will be computed that captures all changes in Betti numbers in the provided data.

Returns

An object of class BettiCurve.


Method apply()

Applies the BettiCurve class on a single persistence diagram and outputs the result.

Usage

BettiCurve$apply(diag)

Arguments

diag

A 2-column tibble::tibble specifying a persistence diagram.

Returns

A tibble::tibble storing the Betti curve representation of the persistence diagram in a table suitable for visualization.


Method clone()

The objects of this class are cloneable with this method.

Usage

BettiCurve$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # reticulate::py_module_available("gudhi")
X <- seq_circle(10)
ac <- AlphaComplex$new(points = X)
st <- ac$create_simplex_tree()
dgm <- st$compute_persistence()$persistence_intervals_in_dimension(0)
ds <- DiagramSelector$new(use = TRUE)
dgm <- ds$apply(dgm)
bc <- BettiCurve$new()
bc$apply(dgm)
bc$fit_transform(list(dgm))
}