perscode

Representation of persistence diagrams using persistence codebooks


Keywords
persistent, homology, persistence, codebooks, diagrams, topological, data, analysis, algebraic, topology
License
MIT
Install
pip install perscode==0.0.1

Documentation

perscode

Vectorization methods for persistence diagrams based in the paper Persistence Codebooks for Topological Data Analysis.

Installation

pip install perscode

Usage

import perscode
import numpy as np

# generate diagrams
diagrams = [np.random.rand(100,2) for _ in range(20)]
for diagram in diagrams:
    diagram[:,1] += diagram[:,0]

# N is the size of the vectors
# normalize is a Bool to whether or not normalize the output vector
pbow = perscode.PBoW(N = 3, normalize = False)
wpbow = perscode.wPBoW(N = 3)
# n_subsample is an int or None. If none all points will be used when calculating GMMs.
spbow = perscode.sPBoW(N = 10, n_subsample = None)

# vectorize diagrams
pbow_diagrams  = pbow.transform(diagrams)
wpbow_diagrams = wpbow.transform(diagrams)
spbow_diagrams = spbow.transform(diagrams)

# for PVLAD and stable PVLAD
pvlad = perscode.PVLAD(N = 3)
spvlad = perscode.sPVLAD(N = 3)

pvlad_diagrams = pvlad.transform(diagrams)
spvlad_diagrams = spvlad.transform(diagrams)

TODO

  • Implement options to pass cluster centers as arguments in wPBoW and sPBoW.
  • Implement PVLAD
  • Implement sPVLAD
  • Implement PFV
  • Implement optional weighted subsampling to wPBoW, sPBoW, sPVLAD classes.
  • Proper documentation