From 3dab4f8ee82eabd9a64eba715aa9c4bb0812ee07 Mon Sep 17 00:00:00 2001 From: Martin ROYER Date: Mon, 18 Sep 2023 19:48:42 +0200 Subject: [PATCH] fix inf points in atol fitting --- src/python/gudhi/representations/vector_methods.py | 4 ++++ 1 file changed, 4 insertions(+) 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]