Persistence Intervals and Diagrams
PersistenceDiagrams.PersistenceInterval
— TypePersistenceInterval{T<:AbstractFloat, C}
The type that represents a persistence interval. It behaves exactly like a Tuple{T, T}
, but may have a representative cocycle attached to it.
PersistenceDiagrams.birth
— Methodbirth(interval::PersistenceInterval)
Get the birth time of interval
.
PersistenceDiagrams.death
— Methoddeath(interval::PersistenceInterval)
Get the death time of interval
.
PersistenceDiagrams.persistence
— Methoddeath(interval::PersistenceInterval)
Get the persistence of interval
, which is equal to death - birth
.
PersistenceDiagrams.representative
— Methodrepresentative(interval::PersistenceInterval)
Get the representative cocycle attached to interval
. If representatives were not computed, throw an error.
PersistenceDiagrams.PersistenceDiagram
— TypePersistenceDiagram{P<:PersistenceInterval} <: AbstractVector{P}
Type for representing persistence diagrams. Behaves exactly like an array of PersistenceInterval
s, but is aware of its dimension and supports pretty printing and plotting.
PersistenceDiagrams.barcode
— Methodbarcode(diagram)
Plot the barcode plot of persistence diagram or multiple diagrams diagrams. The infinity
keyword argument determines where the infinity line is placed. If unset, the function tries to use threshold(diagram)
or guess a good position to place the line at.
Distances Between Persistence Diagrams
PersistenceDiagrams.matching
— Functionmatching(m::Matching; bottleneck=m.bottleneck)
Get the matching of a Matching
object represented by a vector of pairs of intervals. If bottleneck
is set to true, only return the edges with length equal to the weight of the matching.
matching(::Bottleneck, left, right)
Find the bottleneck matching between persistence diagrams left
and right
. Infinite intervals are matched to eachother.
left = PersistenceDiagram(0, [(1.0, 2.0), (5.0, 8.0)])
right = PersistenceDiagram(0, [(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)])
matching(Bottleneck(), left, right)
# Example
# output
3-element Matching with weight 2.0:
[1.0, 2.0) => [1.0, 2.0)
[3.0, 3.0) => [3.0, 4.0)
[5.0, 8.0) => [5.0, 10.0)
See also
matching(::Wasserstein, left, right)
Find the Wasserstein matching between persistence diagrams left
and right
. Infinite intervals are matched to eachother.
Example
left = PersistenceDiagram(0, [(1.0, 2.0), (5.0, 8.0)])
right = PersistenceDiagram(0, [(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)])
matching(Wasserstein(), left, right)
# output
3-element Matching with weight 3.0:
[1.0, 2.0) => [1.0, 2.0)
[3.0, 3.0) => [3.0, 4.0)
[5.0, 8.0) => [5.0, 10.0)
See also
PersistenceDiagrams.distance
— Functiondistance(::Matching)
Get the weight of a Matching
object.
distance(::Bottleneck, left, right)
Compute the bottleneck distance between persistence diagrams left
and right
. Infinite intervals are matched to eachother.
Example
left = PersistenceDiagram(0, [(1.0, 2.0), (5.0, 8.0)])
right = PersistenceDiagram(0, [(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)])
distance(Bottleneck(), left, right)
# output
2.0
See also
distance(::Wasserstein, left, right)
Compute the Wasserstein distance between persistence diagrams left
and right
. Infinite intervals are matched to eachother.
Example
left = PersistenceDiagram(0, [(1.0, 2.0), (5.0, 8.0)])
right = PersistenceDiagram(0, [(1.0, 2.0), (3.0, 4.0), (5.0, 10.0)])
distance(Wasserstein(), left, right)
# output
3.0
See also
PersistenceDiagrams.Bottleneck
— TypeBottleneck
Use this object to find the bottleneck distance or matching between persistence diagrams. The distance value is equal to
where $X$ and $Y$ are the persistence diagrams and $\eta$ is a perfect matching between the intervals. Note the $X$ and $Y$ don't need to have the same number of points, as the diagonal points are considered in the matching as well.
Warning
Computing the bottleneck distance requires $\mathcal{O}(n^2)$ space!
Methods
matching(::Bottleneck, ::Any, ::Any)
: construct a bottleneckMatching
.distance(::Bottleneck, ::Any, ::Any)
: find the bottleneck distance.
PersistenceDiagrams.Wasserstein
— TypeWasserstein(q=1)
Use this object to find the Wasserstein distance or matching between persistence diagrams. The distance value is equal to
where $X$ and $Y$ are the persistence diagrams and $\eta$ is a perfect matching between the intervals. Note the $X$ and $Y$ don't need to have the same number of points, as the diagonal points are considered in the matching as well.
Warning
Computing the Wasserstein distance requires $\mathcal{O}(n^2)$ space!
Methods
matching(::Wasserstein, ::Any, ::Any)
: construct a WassersteinMatching
.distance(::Wasserstein, ::Any, ::Any)
: find the Wasserstein distance.
PersistenceDiagrams.Matching
— Type