diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2021-06-01 19:12:50 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2021-06-01 19:12:50 +0200 |
commit | 4a64eef12722de3faa8ac73416aaea91658e20b6 (patch) | |
tree | ed0c155822ae5e37398f3b528165bf895826b96e /src/python/gudhi/sklearn | |
parent | 5b75186ace327ddc17eb6f06c0ba2485c93235ec (diff) |
Add cubical scikit learn interface documentation and example
Diffstat (limited to 'src/python/gudhi/sklearn')
-rw-r--r-- | src/python/gudhi/sklearn/cubical_persistence.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/python/gudhi/sklearn/cubical_persistence.py b/src/python/gudhi/sklearn/cubical_persistence.py index 809f5d4b..a7a3d036 100644 --- a/src/python/gudhi/sklearn/cubical_persistence.py +++ b/src/python/gudhi/sklearn/cubical_persistence.py @@ -5,7 +5,7 @@ from joblib import Parallel, delayed class CubicalPersistence(BaseEstimator, TransformerMixin): # Fast way to find primes and should be enough - available_primes_ = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] + _available_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] """ This is a class for computing the persistence diagrams from a cubical complex. """ @@ -24,7 +24,7 @@ class CubicalPersistence(BaseEstimator, TransformerMixin): self.persistence_dim = persistence_dim self.homology_coeff_field_ = None - for dim in self.available_primes_: + for dim in self._available_primes: if dim > persistence_dim + 1: self.homology_coeff_field_ = dim break @@ -45,14 +45,11 @@ class CubicalPersistence(BaseEstimator, TransformerMixin): cubical_complex.compute_persistence(homology_coeff_field = self.homology_coeff_field_, min_persistence = self.min_persistence) diagrams = cubical_complex.persistence_intervals_in_dimension(self.persistence_dim) - if self.persistence_dim == 0: - # return all but the last, always [ 0., inf] - diagrams = diagrams[:-1] return diagrams def transform(self, X, Y=None): """ - Compute all the cubical complexes and their persistence diagrams. + Compute all the cubical complexes and their associated persistence diagrams. Parameters: X (list of list of double OR list of numpy.ndarray): List of cells filtration values. |