diff --git a/gtda/diagrams/features.py b/gtda/diagrams/features.py index 3d10db805..e53531c01 100644 --- a/gtda/diagrams/features.py +++ b/gtda/diagrams/features.py @@ -113,7 +113,7 @@ def transform(self, X, y=None): with np.errstate(divide='ignore', invalid='ignore'): Xt = Parallel(n_jobs=self.n_jobs)( - delayed(self._persistence_entropy)(_subdiagrams(X, [dim])[s]) + delayed(self._persistence_entropy)(_subdiagrams(X[s], [dim])) for dim in self.homology_dimensions_ for s in gen_even_slices( X.shape[0], effective_n_jobs(self.n_jobs)) diff --git a/gtda/diagrams/representations.py b/gtda/diagrams/representations.py index 355749aba..16440ae7b 100644 --- a/gtda/diagrams/representations.py +++ b/gtda/diagrams/representations.py @@ -588,13 +588,13 @@ def transform(self, X, y=None): X = check_diagrams(X, copy=True) Xt = Parallel(n_jobs=self.n_jobs, mmap_mode='c')(delayed( - heats)(_subdiagrams(X, [dim], remove_dim=True)[s], + heats)(_subdiagrams(X[s], [dim], remove_dim=True), self._samplings[dim], self._step_size[dim], self.sigma) for dim in self.homology_dimensions_ for s in gen_even_slices(X.shape[0], effective_n_jobs(self.n_jobs))) - Xt = np.concatenate(Xt).reshape(self._n_dimensions, X.shape[0], - self.n_bins, self.n_bins).\ + Xt = np.concatenate(Xt).\ + reshape(self._n_dimensions, X.shape[0], self.n_bins, self.n_bins).\ transpose((1, 0, 2, 3)) return Xt @@ -793,18 +793,19 @@ def transform(self, X, y=None): X = check_diagrams(X, copy=True) Xt = Parallel(n_jobs=self.n_jobs, mmap_mode='c')( - delayed(persistence_images)(_subdiagrams(X, [dim], - remove_dim=True)[s], - self._samplings[dim], - self._step_size[dim], - self.weights_[dim], - self.sigma) + delayed(persistence_images)( + _subdiagrams(X[s], [dim], remove_dim=True), + self._samplings[dim], + self._step_size[dim], + self.weights_[dim], + self.sigma + ) for dim in self.homology_dimensions_ for s in gen_even_slices(X.shape[0], effective_n_jobs(self.n_jobs)) ) - Xt = np.concatenate(Xt).reshape(self._n_dimensions, X.shape[0], - self.n_bins, self.n_bins).\ + Xt = np.concatenate(Xt).\ + reshape(self._n_dimensions, X.shape[0], self.n_bins, self.n_bins).\ transpose((1, 0, 2, 3)) return Xt @@ -975,7 +976,7 @@ def transform(self, X, y=None): X = check_diagrams(X) Xt = (Parallel(n_jobs=self.n_jobs) - (delayed(silhouettes)(_subdiagrams(X, [dim], remove_dim=True)[s], + (delayed(silhouettes)(_subdiagrams(X[s], [dim], remove_dim=True), self._samplings[dim], power=self.power) for dim in self.homology_dimensions_ for s in gen_even_slices(X.shape[0],