From 3b58332d4f5849dd05ee08d8a222ca0fe9475832 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Thu, 14 Nov 2019 13:54:35 +0100 Subject: Syntax of return type in docstring --- src/python/gudhi/sktda/kernel_methods.py | 8 ++++---- src/python/gudhi/sktda/metrics.py | 6 +++--- src/python/gudhi/sktda/preprocessing.py | 12 ++++++------ src/python/gudhi/sktda/vector_methods.py | 14 +++++++------- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/python/gudhi') diff --git a/src/python/gudhi/sktda/kernel_methods.py b/src/python/gudhi/sktda/kernel_methods.py index d409accd..e93138e6 100644 --- a/src/python/gudhi/sktda/kernel_methods.py +++ b/src/python/gudhi/sktda/kernel_methods.py @@ -50,7 +50,7 @@ class SlicedWassersteinKernel(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise sliced Wasserstein kernel values. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise sliced Wasserstein kernel values. """ return np.exp(-self.sw_.transform(X)/self.bandwidth) @@ -92,7 +92,7 @@ class PersistenceWeightedGaussianKernel(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise persistence weighted Gaussian kernel values. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise persistence weighted Gaussian kernel values. """ Xp = list(X) Xfit = np.zeros((len(Xp), len(self.diagrams_))) @@ -157,7 +157,7 @@ class PersistenceScaleSpaceKernel(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise persistence scale space kernel values. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise persistence scale space kernel values. """ Xp = list(X) for i in range(len(Xp)): @@ -200,7 +200,7 @@ class PersistenceFisherKernel(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise persistence Fisher kernel values. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise persistence Fisher kernel values. """ return np.exp(-self.pf_.transform(X)/self.bandwidth) diff --git a/src/python/gudhi/sktda/metrics.py b/src/python/gudhi/sktda/metrics.py index f55f553b..c51b8f3b 100644 --- a/src/python/gudhi/sktda/metrics.py +++ b/src/python/gudhi/sktda/metrics.py @@ -58,7 +58,7 @@ class SlicedWassersteinDistance(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise sliced Wasserstein distances. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise sliced Wasserstein distances. """ Xfit = np.zeros((len(X), len(self.approx_))) if len(self.diagrams_) == len(X) and np.all([np.array_equal(self.diagrams_[i], X[i]) for i in range(len(X))]): @@ -114,7 +114,7 @@ class BottleneckDistance(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise bottleneck distances. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise bottleneck distances. """ num_diag1 = len(X) @@ -182,7 +182,7 @@ class PersistenceFisherDistance(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X)): matrix of pairwise persistence Fisher distances. + numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise persistence Fisher distances. """ Xfit = np.zeros((len(X), len(self.diagrams_))) if len(self.diagrams_) == len(X) and np.all([np.array_equal(self.diagrams_[i], X[i]) for i in range(len(X))]): diff --git a/src/python/gudhi/sktda/preprocessing.py b/src/python/gudhi/sktda/preprocessing.py index 6bc7ec52..294b5aeb 100644 --- a/src/python/gudhi/sktda/preprocessing.py +++ b/src/python/gudhi/sktda/preprocessing.py @@ -43,7 +43,7 @@ class BirthPersistenceTransform(BaseEstimator, TransformerMixin): X (list of n x 2 numpy array): input persistence diagrams. Returns: - Xfit (list of n x 2 numpy array): transformed persistence diagrams. + list of n x 2 numpy array: transformed persistence diagrams. """ Xfit = [] for diag in X: @@ -85,7 +85,7 @@ class Clamping(BaseEstimator, TransformerMixin): X (numpy array of size n): input list of values. Returns: - Xfit (numpy array of size n): output list of values. + numpy array of size n: output list of values. """ Xfit = np.minimum(X, self.limit) #Xfit = np.where(X >= self.limit, self.limit * np.ones(X.shape), X) @@ -131,7 +131,7 @@ class DiagramScaler(BaseEstimator, TransformerMixin): X (list of n x 2 or n x 1 numpy arrays): input persistence diagrams. Returns: - Xfit (list of n x 2 or n x 1 numpy arrays): transformed persistence diagrams. + list of n x 2 or n x 1 numpy arrays: transformed persistence diagrams. """ Xfit = [np.copy(d) for d in X] if self.use: @@ -174,7 +174,7 @@ class Padding(BaseEstimator, TransformerMixin): X (list of n x 2 or n x 1 numpy arrays): input persistence diagrams. Returns: - Xfit (list of n x 3 or n x 2 numpy arrays): padded persistence diagrams. + list of n x 3 or n x 2 numpy arrays: padded persistence diagrams. """ if self.use: Xfit, num_diag = [], len(X) @@ -223,7 +223,7 @@ class ProminentPoints(BaseEstimator, TransformerMixin): X (list of n x 2 or n x 1 numpy arrays): input persistence diagrams. Returns: - Xfit (list of n x 2 or n x 1 numpy arrays): thresholded persistence diagrams. + list of n x 2 or n x 1 numpy arrays: thresholded persistence diagrams. """ if self.use: Xfit, num_diag = [], len(X) @@ -292,7 +292,7 @@ class DiagramSelector(BaseEstimator, TransformerMixin): X (list of n x 2 or n x 1 numpy arrays): input persistence diagrams. Returns: - Xfit (list of n x 2 or n x 1 numpy arrays): extracted persistence diagrams. + list of n x 2 or n x 1 numpy arrays: extracted persistence diagrams. """ if self.use: Xfit, num_diag = [], len(X) diff --git a/src/python/gudhi/sktda/vector_methods.py b/src/python/gudhi/sktda/vector_methods.py index c1824ebb..91f1bc31 100644 --- a/src/python/gudhi/sktda/vector_methods.py +++ b/src/python/gudhi/sktda/vector_methods.py @@ -58,7 +58,7 @@ class PersistenceImage(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (number of pixels = **resolution[0]** x **resolution[1]**)): output persistence images. + numpy array with shape (number of diagrams) x (number of pixels = **resolution[0]** x **resolution[1]**): output persistence images. """ num_diag, Xfit = len(X), [] new_X = BirthPersistenceTransform().fit_transform(X) @@ -118,7 +118,7 @@ class Landscape(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (number of samples = **num_landscapes** x **resolution**)): output persistence landscapes. + numpy array with shape (number of diagrams) x (number of samples = **num_landscapes** x **resolution**): output persistence landscapes. """ num_diag, Xfit = len(X), [] x_values = np.linspace(self.sample_range[0], self.sample_range[1], self.resolution) @@ -200,7 +200,7 @@ class Silhouette(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (**resolution**): output persistence silhouettes. + numpy array with shape (number of diagrams) x (**resolution**): output persistence silhouettes. """ num_diag, Xfit = len(X), [] x_values = np.linspace(self.sample_range[0], self.sample_range[1], self.resolution) @@ -277,7 +277,7 @@ class BettiCurve(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (**resolution**): output Betti curves. + numpy array with shape (number of diagrams) x (**resolution**): output Betti curves. """ num_diag, Xfit = len(X), [] x_values = np.linspace(self.sample_range[0], self.sample_range[1], self.resolution) @@ -339,7 +339,7 @@ class Entropy(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (1 if **mode** = "scalar" else **resolution**)): output entropy. + numpy array with shape (number of diagrams) x (1 if **mode** = "scalar" else **resolution**): output entropy. """ num_diag, Xfit = len(X), [] x_values = np.linspace(self.sample_range[0], self.sample_range[1], self.resolution) @@ -402,7 +402,7 @@ class TopologicalVector(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (**threshold**): output topological vectors. + numpy array with shape (number of diagrams) x (**threshold**): output topological vectors. """ if self.threshold == -1: thresh = np.array([X[i].shape[0] for i in range(len(X))]).max() @@ -456,7 +456,7 @@ class ComplexPolynomial(BaseEstimator, TransformerMixin): X (list of n x 2 numpy arrays): input persistence diagrams. Returns: - Xfit (numpy array with shape (number of diagrams) x (**threshold**): output complex vectors of coefficients. + numpy array with shape (number of diagrams) x (**threshold**): output complex vectors of coefficients. """ if self.threshold == -1: thresh = np.array([X[i].shape[0] for i in range(len(X))]).max() -- cgit v1.2.3