MaartenGr / MaartenGr/BERTopic
model.get_topic_freq() show different count per topic than i get by using document_topics, _ = model.transform(data['text']) and filter the rows
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
i have a 5 mil rows dataset of Reddit posts i am doing topic analysis on.
i fitted the model, all seems to make sense, the clusters i got make sense.
When I look at the cluster's sizes in model.get_topic_freq() it shows the counts for each topic ( how many documents are in the cluster)
however when i run document_topics, _ = model.transform(data['text']) and look at the rows in the dataset that correspond to a topic, it shows a different count...
for example for topic 4:
model.get_topic_freq() -> gives a count of about 3000
len(data[document_topics == 4])-> gives a count of around 6000
when i look at the text in those rows it is making sense ...again...the topic makes sense.... but the counts differ ...
why is this happening ... i can't understand it ??
sorry if this is a silly question, please if there is documentation that would help with this link to it ...i looked but can't seem to find anything that would clarify this issue...
thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported calls to model.get_topic_freq() and model.transform(data['text']), reproducing the differing counts on the Reddit dataset. Compare the topic assignments returned by each entry point and check the BERTopic documentation for the documented meaning of each result; done means the discrepancy is explained or confirmed as a defect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100