Skip to content

Instantly share code, notes, and snippets.

@lewtun
Last active January 23, 2020 14:33
Show Gist options
  • Save lewtun/6cb6a44bcc7deea3815e9455f38ca71a to your computer and use it in GitHub Desktop.
Save lewtun/6cb6a44bcc7deea3815e9455f38ca71a to your computer and use it in GitHub Desktop.
import gtda.homology as hl
# represent data as a matrix of pairwise distances
distance_matrix = ...
# define topological features to track
homology_dimensions = [0, 1, 2]
# define simplicial complex to construct
persistence = hl.VietorisRipsPersistence(
metric="precomputed", homology_dimensions=homology_dimensions
)
# calculate persistence diagram
persistence_diagram = persistence.fit_transform(distance_matrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment