MyNixOS website logo
Description

Uniform Manifold Samplers for Topological Data Analysis.

Uniform random samples from simple manifolds, sometimes with noise, are commonly used to test topological data analytic (TDA) tools. This package includes samplers powered by two techniques: analytic volume-preserving parameterizations, as employed by Arvo (1995) <doi:10.1145/218380.218500>, and rejection sampling, as employed by Diaconis, Holmes, and Shahshahani (2013) <doi:10.1214/12-IMSCOLL1006>.

CRAN downloads

tdaunif: Uniform manifold samplers for topological data analysis

This R package contains sampling functions for topological manifolds embedded (or immersed) in Euclidean space.

motivation

consolidation

Statistical topology and topological data analysis include a variety of methods for detecting topological structure from point cloud data sets, most famously persistent homology. (See Weinberger (2011) for a brief introduction.) These methods are often validated by applying them to point clouds sampled from spaces with known topology. Functions that generate such samples are therefore valuable to developers of topological–statistical software.

Such samplers have not been easy to find in the R package ecosystem. Handfuls exist in several different packages, but no single package or code repository has assembled a large collection for convenient use. That is the goal of this package.

uniformity

The simplest validations use points sampled uniformly from the surfaces of manifolds embedded in Euclidean space. Uniformity here is with respect to the surface area of the embedded manifold, but such uniform sampling is not trivial to do when the manifold can only be expressed via parameterization from a simpler parameter space, as when a square is rolled and bent into a torus. Uniform sampling on the parameter space may then produce uneven sampling on the manifold, regions of greater compression being oversampled relative to regions of greater expansion. One especially important motivation for this package is therefore to include uniform samplers for popular embeddings of topological manifolds, including functions that allow users to build their own with minimal effort (see help(manifold, package = "tdaunif")).

usage

installation

The latest release of tdaunif can be installed from CRAN:

install.packages("tdaunif")

You can install the current development version of tdaunif from GitHub using the remotes package:

remotes::install_github("tdaverse/tdaunif", build_vignettes = TRUE)

To stabilize this document, this chunk saves the default graphics settings (as required by CRAN) and initializes the random number generator:

oldpar <- par(no.readonly = TRUE)
set.seed(0)

illustration

An intuitive embedding of the Klein bottle into 4-space is adapted from the popular “donut” embedding of the torus in 3-space. In tdaunif this is called the “tube” parameterization. We can sample uniformly from this embedding (without noise) and examine the coordinate projections as follows:

x <- sample_klein_tube(n = 360, ar = 3, sd = 0)
pairs(x, asp = 1, pch = 19, cex = .5)

Compare these neat projections to those of the same sample with noise added in the ambient Euclidean space:

x <- add_noise(x, sd = .2)
pairs(x, asp = 1, pch = 19, cex = .5)

For a thorough discussion of this sampler, see my blog post describing the method presented in Diaconis, Holmes, and Shahshahani (2013).

another illustration

A subset of samplers allow stratified sampling, which relies on an analytic solution to the problem of length or area distortion created by most parameterizations. For example, the planar triangle sampler can be stratified to produce a more uniform arrangement of points than a properly uniform sample would produce:

equilateral <- cbind(c(0,0), c(0.5,sqrt(3)/2), c(1,0))
x <- sample_triangle_planar(n = 720, triangle = equilateral)
y <- sample_triangle_planar(n = 720, triangle = equilateral, bins = 24)
par(mfrow = c(1L, 2L))
plot(x, asp = 1, pch = 19, cex = .5)
plot(y, asp = 1, pch = 19, cex = .5)

See Arvo (1995) and Arvo’s notes from Siggraph 2001 for a detailed treatment of this technique.

par(oldpar)
Metadata

Version

0.2.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows