/RobustTDA.jl

A collection of tools for robust topological data analysis

Primary LanguageJuliaMIT LicenseMIT

RobustTDA.jl

Robust Topological Data Analysis in Julia.

Stable Dev Build Status Coverage

RobustTDA.jl

RobustTDA.jl provides a robust and flexible framework for computing persistent homology from point-cloud data in the presence of noise. RobustTDA uses the blazing fast Ripserer.jl backend for computing persistent homology.

Please see the documentation for further information, usage and examples.

Getting Started

Installation

From the Julia REPL, type ] to enter the Pkg REPL mode and run

    pkg> add https://github.com/sidv23/RobustTDA.jl

Example

Generate some data

using RobustTDA
using Pipe

# Signal from a circle with noise
signal = 2 .* randCircle(500, sigma = 0.05)

# Outliers from a Matérn cluster process
win = (-1, 1, -1, 1)
noise = randMClust(100, window = win, λ1 = 2, λ2 = 10, r = 0.05)

X = [signal; noise]
points = [signal; noise]
scatter(points)

Points

First, convert the data to a vector-format, i.e.,

Xn = [[x...] for x in points]

*All rountines in the package currently read the input point-cloud data as a vector of vectors

plt = f -> plot(xseq, yseq, (x,y) -> RobustTDA.fit([[x,y]],f), st=:surface)

Construct a filter function from the samples $\mathbb{X}_n$. For example,

  1. Vanilla Distance function:
        f_dist = dist(Xn)
        plt(f_dist)
        
        # RobustTDA.DistanceFunction
        # k: Int64 1
        # trees: Array{KDTree{StaticArrays.SVector{2, Float64}, Euclidean, Float64}}((1,))
        # X: Array{Vector{Vector{Float64}}}((1,))
        # type: String "dist"
        # Q: Int64 1
  2. Distance-to-measure:
        f_dtm = dtm(Xn, 0.1)
        plt(f_dtm)
    
        # RobustTDA.DistanceFunction
        # k: Int64 60
        # trees: Array{BruteTree{StaticArrays.SVector{2, Float64}, Euclidean}}((1,))
        # X: Array{Vector{Vector{Float64}}}((1,))
        # type: String "dtm"
        # Q: Int64 1
  3. Median-of-means Distance Function:
         f_momdist = momdist(Xn, 101)
         plt(f_momdist)
    
         # RobustTDA.DistanceFunction
         # k: Int64 1
         # trees: Array{KDTree{StaticArrays.SVector{2, Float64}, Euclidean, Float64}}((201,))
         # X: Array{SubArray{Vector{Float64}, 1, Vector{Vector{Float64}}, Tuple{Vector{Int64}}, false}}((201,))
         # type: String "momdist"
         # Q: Int64 201

For sublevel persistent homology, you need to specify a grid to evaluate the filter functions

    xseq = -3:0.05:3
    yseq = -3:0.05:3
    F_grid = [RobustTDA.fit([[x, y]], f) for x in xseq, y in yseq]
    D = F_grid |> Cubical |> ripserer

MoM Dist

The code accompanying the paper Robust Topological Inference in the Presence of Outliers, and for computing MoMDist-weighted filtrations please see the MoMDist repository

https://github.com/sidv23/momdist

Citation

@article{
    vishwanath2022momdist,
    title = {Robust Topological Inference in the Presence of Outliers},
    author = {
        Vishwanath, Siddharth and 
        Sriperumbudur, Bharath K. and 
        Fukumizu, Kenji and 
        Kuriki, Satoshi
    },
    journal={arXiv preprint arXiv:2206.01795},
    year = {2022}
    keywords = {62R40, 55N31, 68T09},
    url = {https://arxiv.org/abs/2206.01795},
}