Skip to content

Commit 13b21fd

Browse files
committed
reformatting
1 parent 9afb686 commit 13b21fd

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

umap/spectral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def component_layout(
133133
component_centroids, metric=metric, **metric_kwds
134134
)
135135

136-
affinity_matrix = np.exp(-(distance_matrix ** 2))
136+
affinity_matrix = np.exp(-(distance_matrix**2))
137137

138138
component_embedding = SpectralEmbedding(
139139
n_components=dim, affinity="precomputed", random_state=random_state

umap/umap_.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,18 +1795,26 @@ def _validate_parameters(self):
17951795
if self.n_components < 1:
17961796
raise ValueError("n_components must be greater than 0")
17971797
self.n_epochs_list = None
1798-
if isinstance(self.n_epochs, list) or isinstance(self.n_epochs, tuple) or \
1799-
isinstance(self.n_epochs, np.ndarray):
1800-
if not issubclass(np.array(self.n_epochs).dtype.type, np.integer) or \
1801-
not np.all(np.array(self.n_epochs) >= 0):
1802-
raise ValueError("n_epochs must be a nonnegative integer "
1803-
"or a list of nonnegative integers")
1798+
if (
1799+
isinstance(self.n_epochs, list)
1800+
or isinstance(self.n_epochs, tuple)
1801+
or isinstance(self.n_epochs, np.ndarray)
1802+
):
1803+
if not issubclass(
1804+
np.array(self.n_epochs).dtype.type, np.integer
1805+
) or not np.all(np.array(self.n_epochs) >= 0):
1806+
raise ValueError(
1807+
"n_epochs must be a nonnegative integer "
1808+
"or a list of nonnegative integers"
1809+
)
18041810
self.n_epochs_list = list(self.n_epochs)
18051811
elif self.n_epochs is not None and (
1806-
self.n_epochs < 0 or not isinstance(self.n_epochs, int)
1812+
self.n_epochs < 0 or not isinstance(self.n_epochs, int)
18071813
):
1808-
raise ValueError("n_epochs must be a nonnegative integer "
1809-
"or a list of nonnegative integers")
1814+
raise ValueError(
1815+
"n_epochs must be a nonnegative integer "
1816+
"or a list of nonnegative integers"
1817+
)
18101818
if self.metric_kwds is None:
18111819
self._metric_kwds = {}
18121820
else:
@@ -2765,7 +2773,9 @@ def fit(self, X, y=None):
27652773
print(ts(), "Construct embedding")
27662774

27672775
if self.transform_mode == "embedding":
2768-
epochs = self.n_epochs_list if self.n_epochs_list is not None else self.n_epochs
2776+
epochs = (
2777+
self.n_epochs_list if self.n_epochs_list is not None else self.n_epochs
2778+
)
27692779
self.embedding_, aux_data = self._fit_embed_data(
27702780
self._raw_data[index],
27712781
epochs,
@@ -2775,11 +2785,15 @@ def fit(self, X, y=None):
27752785

27762786
if self.n_epochs_list is not None:
27772787
if "embedding_list" not in aux_data:
2778-
raise KeyError("No list of embedding were found in 'aux_data'. "
2779-
"It is likely the layout optimization function "
2780-
"doesn't support the list of int for 'n_epochs'.")
2788+
raise KeyError(
2789+
"No list of embedding were found in 'aux_data'. "
2790+
"It is likely the layout optimization function "
2791+
"doesn't support the list of int for 'n_epochs'."
2792+
)
27812793
else:
2782-
self.embedding_list_ = [e[inverse] for e in aux_data["embedding_list"]]
2794+
self.embedding_list_ = [
2795+
e[inverse] for e in aux_data["embedding_list"]
2796+
]
27832797

27842798
# Assign any points that are fully disconnected from our manifold(s) to have embedding
27852799
# coordinates of np.nan. These will be filtered by our plotting functions automatically.

0 commit comments

Comments
 (0)