MaartenGr / MaartenGr/BERTopic
Extending ".visulize_document_datamap" with "label_over_points"-flag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hey @MaartenGr! Great work on this library. I recently came across an underlying functionality of datamapplot and noticed it is not yet implemented in the BERTopic package. I assume this relates to an updated DataMapPlot-version.
In detail: The DataMapPlot-lib allows me to assign the labels on top of the clusters instead of using "straight line pointers". This may be helpful to handle large visualizations with many clusters to ensure readability. I was not able to pass the "label_over_points" flag to the "visualize_document_datamap". The docs for the according DataMapPlot section can be found here: https://datamapplot.readthedocs.io/en/latest/label_over_points.html
My current workaround is to use the most recent version of DataMapPlot and pass in the UMAP-Embeddings, topic labels and desired DataMapPlot-flags directly. Therefore I avoid using the ".visualize_document_datamap"-Method on my topic_model.
`import datamapplot`
`fig, ax = datamapplot.create_plot(umap_embeddings, labels, label_over_points=True)`
`plt.show()`
An manual update of the underlying DataMapPlot package via pip however seems to solve the issue for me. You might wanna have a look into that. Thanks in advance!
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 at the visualize_document_datamap method and compare its available arguments with datamapplot.create_plot and the linked DataMapPlot label_over_points documentation. Trace how UMAP embeddings, labels, and DataMapPlot flags are passed through the method. Done means callers can provide label_over_points and obtain the corresponding label-over-points visualization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100