MaartenGr / MaartenGr/BERTopic
model.visualize_hierarchical_documents now shows whole topics
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description



As a result of the topic modeling, I got 40 topics.
And in the topic data frame, I can identify topics 10 and 13.
You can also see them in the topic distance visualization, Hierarchical topic clustering analysis still shows these two topics.

However, when I run topic_model.visualize_hierarchical_documents(), I lose random topics. Whenever I change the number of topics while adjusting the superparameters, I lose 1-2 topics each time.
At first I suspected that the number of documents in a topic was too small to be visualized, but even topics with fewer documents than topics 10 and 13 were visualized.
I followed the steps in the following article.
https://maartengr.github.io/BERTopic/api/plotting/hierarchical_documents.html#bertopic.plotting._hierarchical_documents.visualize_hierarchical_documents
In the above article, I don't see any missing topics.
What could be the problem and how can I fix it?
I'm running with bertopic 0.15.0
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
The report points to topic_model.visualize_hierarchical_documents(), BERTopic 0.15.0, the topic data frame, and the hierarchical topic clustering visualization. Start by reproducing the missing-topic behavior with the reported version and compare the topics shown by each visualization. Done means the hierarchical document visualization consistently includes the topics present in the model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100