summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieu <mathieu.carriere3@gmail.com>2019-12-11 15:30:45 -0500
committermathieu <mathieu.carriere3@gmail.com>2019-12-11 15:30:45 -0500
commit2886885ff4cf1f134863de0fa97b64f824d67622 (patch)
tree8b81f3683b2d3c425ad21a09cd5fc8100e7d9965 /src
parent9e75cc1832403f8ffec38fc3a4f6b1081fe4770e (diff)
cleanup
Diffstat (limited to 'src')
-rw-r--r--src/python/gudhi/representations/vector_methods.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py
index cd532275..9b280f68 100644
--- a/src/python/gudhi/representations/vector_methods.py
+++ b/src/python/gudhi/representations/vector_methods.py
@@ -95,6 +95,7 @@ class Landscape(BaseEstimator, TransformerMixin):
sample_range ([double, double]): minimum and maximum of all piecewise-linear function domains, of the form [x_min, x_max] (default [numpy.nan, numpy.nan]). It is the interval on which samples will be drawn evenly. If one of the values is numpy.nan, it can be computed from the persistence diagrams with the fit() method.
"""
self.num_landscapes, self.resolution, self.sample_range = num_landscapes, resolution, sample_range
+ self.nan_in_range = np.isnan(np.array(self.sample_range))
def fit(self, X, y=None):
"""
@@ -104,8 +105,7 @@ class Landscape(BaseEstimator, TransformerMixin):
X (list of n x 2 numpy arrays): input persistence diagrams.
y (n x 1 array): persistence diagram labels (unused).
"""
- self.nan_in_range = np.isnan(np.array(self.sample_range))
- if np.isnan(np.array(self.sample_range)).any():
+ if self.nan_in_range.any():
pre = DiagramScaler(use=True, scalers=[([0], MinMaxScaler()), ([1], MinMaxScaler())]).fit(X,y)
[mx,my],[Mx,My] = [pre.scalers[0][1].data_min_[0], pre.scalers[1][1].data_min_[0]], [pre.scalers[0][1].data_max_[0], pre.scalers[1][1].data_max_[0]]
self.sample_range = np.where(self.nan_in_range, np.array([mx, My]), np.array(self.sample_range))