MaartenGr / MaartenGr/BERTopic

Intertopic Distance Map keeps changing every time I rerun it

Open
#1,822 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hello there,

So I am pretty new to this, but I am really interested in using this to explore my corpus. I am not sure if this is inherent in the code itself, but whenever I try to rerun it, it keeps loading a different form of intertopic distance map. So this means that I cannot replicate it which is not ideal. I have attached below the codes that I used. Thank you!

`
df_clean = df.dropna(subset=['Policy_Content'])
umap = UMAP(n_neighbors=15,
n_components=5,
min_dist=0.0,
metric='cosine',
low_memory=False,
random_state=123)
vectorizer_model = CountVectorizer(stop_words="english", min_df=2, ngram_range=(1, 2))

topic_model = BERTopic(umap_model=umap,vectorizer_model=vectorizer_model, verbose=True)
topics, probs = topic_model.fit_transform(df_clean['Policy_Content'])
#227 topics in total
topic_model.reduce_topics(df_clean['Policy_Content'], nr_topics=48)

topic_model.visualize_topics()
`

Warm regards,
Yanith

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Python snippet and the UMAP, BERTopic.fit_transform, reduce_topics, and visualize_topics calls. Rerun the same corpus and configuration while checking how each stage affects the intertopic distance map. Done means identifying the source of the differing outputs and establishing whether the result can be reproduced with this setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.