giotto.diagrams
.Filtering¶
-
class
giotto.diagrams.
Filtering
(homology_dimensions=None, epsilon=0.01)¶ Filtering of persistence diagrams.
Filtering a diagram means removing all points whose distance from the diagonal is less than or equal to a certain cutoff value which can be interpreted as (\(1/\sqrt{2}\) times) the “minimum amount of persistence” required from points in the filtered diagram.
- Parameters
- homology_dimensionsiterable or None, optional, default:
None
When set to
None
, subdiagrams corresponding to all homology dimensions seen infit
will be filtered. Otherwise, it contains the homology dimensions at which filtering should occur.- epsilonfloat, optional, default:
0.01
The cutoff value controlling the amount of filtering.
- homology_dimensionsiterable or None, optional, default:
- Attributes
- homology_dimensions_list
If homology_dimensions is set to
None
, then this is the list of homology dimensions seen infit
, sorted in ascending order. Otherwise, it is a similarly sorted version of homology_dimensions.
See also
Methods
fit
(self, X[, y])Store relevant homology dimensions in
homology_dimensions_
.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])Filter all relevant persistence subdiagrams.
-
__init__
(self, homology_dimensions=None, epsilon=0.01)¶ Initialize self. See help(type(self)) for accurate signature.
-
fit
(self, X, y=None)¶ Store relevant homology dimensions in
homology_dimensions_
. Then, return the estimator.This method is there to implement the usual scikit-learn 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)¶ Filter all relevant persistence subdiagrams.
- 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_features, 3)
Filtered persistence diagrams. Only the subdiagrams corresponding to dimensions in
homology_dimensions_
are filtered. Discarded points are replaced by points on the diagonal.