Skip to content

Commit 18c5d96

Browse files
committed
Add descriptive variable names
1 parent fb0fdb4 commit 18c5d96

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

machine_learning/t_stochastic_neighbour_embedding.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,23 @@ def main() -> None:
146146
t-SNE embedding (first 5 points):
147147
[[...
148148
"""
149-
data_x,labels = collect_dataset()
150-
y_emb = apply_tsne(data_x, n_components=2, n_iter=300)
149+
features, labels = collect_dataset()
150+
embedding = apply_tsne(features, n_components=2, n_iter=300)
151151

152152
if not isinstance(embedding, np.ndarray):
153153
raise TypeError("t-SNE embedding must be an ndarray")
154154

155155
print("t-SNE embedding (first 5 points):")
156156
print(embedding[:5])
157157

158-
# Optional visualization ( Ruff/mypy compliant)
159-
import matplotlib.pyplot as plt
160-
plt.scatter(
161-
y_emb[:, 0],
162-
y_emb[:, 1],
163-
c=labels,
164-
cmap="viridis"
165-
)
166-
plt.title("t-SNE Visualization of Iris Dataset")
167-
plt.xlabel("Dimension 1")
168-
plt.ylabel("Dimension 2")
169-
plt.show()
158+
# Optional visualization (Ruff/mypy compliant)
159+
160+
# import matplotlib.pyplot as plt
161+
# plt.scatter(embedding[:, 0], embedding[:, 1], c=labels, cmap="viridis")
162+
# plt.title("t-SNE Visualization of the Iris Dataset")
163+
# plt.xlabel("Dimension 1")
164+
# plt.ylabel("Dimension 2")
165+
# plt.show()
170166

171167

172168
if __name__ == "__main__":

0 commit comments

Comments
 (0)