Skip to content

Instantly share code, notes, and snippets.

@ZhangzihanGit
Last active May 19, 2022 03:22
Show Gist options
  • Save ZhangzihanGit/7966c5d24400e04ed0acedc4cb7f96cd to your computer and use it in GitHub Desktop.
Save ZhangzihanGit/7966c5d24400e04ed0acedc4cb7f96cd to your computer and use it in GitHub Desktop.
if reduce_size:
# reduce embedding dimensionality
embeddings = UMAP(n_neighbors=15,
n_components=10,
min_dist=0.0,
metric='cosine',
random_state=42
).fit_transform(embeddings)
# clustering, here we set 5 clusters, i.e. 5 topics
kmeans = KMeans(5)
documents = kmeans.fit(embeddings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment