diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py index 05fa7db122..71fc07b6d1 100644 --- a/src/python/gudhi/representations/vector_methods.py +++ b/src/python/gudhi/representations/vector_methods.py @@ -781,6 +781,10 @@ def fit(self, X, y=None, sample_weight=None): """ if not hasattr(self.quantiser, 'fit'): raise TypeError("quantiser %s has no `fit` attribute." % (self.quantiser)) + + # In fitting we remove infinite death time points so that every center is finite + X = [dgm[~np.isinf(dgm).any(axis=1), :] for dgm in X] + if sample_weight is None: sample_weight = [self.get_weighting_method()(measure) for measure in X]