giotto.diagrams
.Amplitude¶

class
giotto.diagrams.
Amplitude
(metric='landscape', metric_params=None, order=2.0, n_jobs=None)¶ Amplitudes of persistence diagrams, constructed from the amplitudes of their subdiagrams with constant homology dimension.
Given a single persistence diagram consisting of birthdeathdimension triples [b, d, q], a vector of amplitudes or a single scalar amplitude is calculated according to the following steps:
All diagrams are partitioned into subdiagrams corresponding to distinct homology dimensions.
The amplitude of each subdiagram is calculated according to the parameters metric and metric_params. This gives a vector of amplitudes, \(\mathbf{a} = (a_{q_1}, \ldots, a_{q_n})\).
The final result is either \(\mathbf{a}\) itself or a norm of \(\mathbf{a}\).
 Parameters
 metric
'bottleneck'
'wasserstein'
'landscape'
'betti'
'heat'
, optional, default:'landscape'
Distance or dissimilarity function used to define the amplitude of a subdiagram as its distance from the diagonal diagram:
'bottleneck'
and'wasserstein'
refer to the identically named perfectmatching–based notions of distance.'landscape'
refers to the \(L^p\) distance between persistence landscapes.'betti'
refers to the \(L^p\) distance between Betti curves.'heat'
refers to the \(L^p\) distance between Gaussiansmoothed diagrams.
 metric_paramsdict or None, optional, default:
None
Additional keyword arguments for the metric function:
If
metric == 'bottleneck'
there are no available arguments.If
metric == 'wasserstein'
the only argument is p (int, default:2
).If
metric == 'betti'
the available arguments are p (float, default:2.
) and n_values (int, default:100
).If
metric == 'landscape'
the available arguments are p (float, default:2.
), n_values (int, default:100
) and n_layers (int, default:1
).If
metric == 'heat'
the available arguments are p (float, default:2.
), sigma (float, default:1.
) and n_values (int, default:100
).
 orderfloat or None, optional, default:
2.
If
None
,transform
returns for each diagram a vector of amplitudes corresponding to the dimensions inhomology_dimensions_
. Otherwise, the \(p\)norm of these vectors with \(p\) equal to order is taken. n_jobsint or None, optional, default:
None
The number of jobs to use for the computation.
None
means 1 unless in ajoblib.parallel_backend
context.1
means using all processors.
 metric
 Attributes
See also
Notes
To compute amplitudes without first splitting the computation between different homology dimensions, data should be first transformed by an instance of
ForgetDimension
.Methods
fit
(self, X[, y])Store all observed homology dimensions in
homology_dimensions_
and computeeffective_metric_params
.fit_transform
(self, X[, y])Fit to data, then transform it.
get_params
(self[, deep])Get parameters for this estimator.
set_params
(self, \*\*params)Set the parameters of this estimator.
transform
(self, X[, y])Compute the amplitudes or amplitude vectors of diagrams in X.

__init__
(self, metric='landscape', metric_params=None, order=2.0, n_jobs=None)¶ Initialize self. See help(type(self)) for accurate signature.

fit
(self, X, y=None)¶ Store all observed homology dimensions in
homology_dimensions_
and computeeffective_metric_params
. Then, return the estimator.This method is there to implement the usual scikitlearn API and hence work in pipelines.
 Parameters
 Xndarray, shape (n_samples, n_features, 3)
Input data. Array of persistence diagrams, each a collection of triples [b, d, q] representing persistent topological features through their birth (b), death (d) and homology dimension (q).
 yNone
There is no need for a target in a transformer, yet the pipeline API requires this parameter.
 Returns
 selfobject

fit_transform
(self, X, y=None, **fit_params)¶ Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
 Parameters
 Xnumpy array of shape [n_samples, n_features]
Training set.
 ynumpy array of shape [n_samples]
Target values.
 Returns
 X_newnumpy array of shape [n_samples, n_features_new]
Transformed array.

get_params
(self, deep=True)¶ Get parameters for this estimator.
 Parameters
 deepboolean, optional
If True, will return the parameters for this estimator and contained subobjects that are estimators.
 Returns
 paramsmapping of string to any
Parameter names mapped to their values.

set_params
(self, **params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object. Returns
 self

transform
(self, X, y=None)¶ Compute the amplitudes or amplitude vectors of diagrams in X.
 Parameters
 Xndarray, shape (n_samples, n_features, 3)
Input data. Array of persistence diagrams, each a collection of triples [b, d, q] representing persistent topological features through their birth (b), death (d) and homology dimension (q).
 yNone
There is no need for a target in a transformer, yet the pipeline API requires this parameter.
 Returns
 Xtndarray, shape (n_samples, n_homology_dimensions) if order is
None
, else (n_samples, 1) Amplitudes or amplitude vectors of the diagrams in X. In the second case, index i along axis 1 corresponds to the ith homology dimension in
homology_dimensions_
.
 Xtndarray, shape (n_samples, n_homology_dimensions) if order is