Skip to content

Instantly share code, notes, and snippets.

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