MaartenGr / MaartenGr/BERTopic
bug with custom_labels in _topics_over_time.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hi,
it seems there is a bu in _topics_over_time.py when using custom_labels. In line 67, you loop over topics, but I think it should be selected_topics. My local fix for this line is:
topic_names = [[[str(topic), None]] + topic_model.topic_aspects_[custom_labels][topic] for topic in selected_topics]
Furthermore, line 70 also break down, as you are iterating over all topics and topic_names many not include all of them. I have changed it to:
topic_names = {key: topic_names[index] for index, key in enumerate(selected_topics)}
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 in _topics_over_time.py at lines 67 and 70, then reproduce the custom_labels case with a subset of selected_topics. Verify that topic names are generated and mapped only for the selected topics, and confirm the behavior with the relevant existing tests or a focused reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100