Download BERTopic/tests/test_plotting/test_heatmap.py from kisejin/TopicModelingRepo: direct link, hf CLI and curl.
- Browser
- Download file 677 Bytes
-
https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_heatmap.py
- Command line
-
hf download hf://kisejin/TopicModelingRepo@5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_heatmap.py
-
curl -L -o test_heatmap.py https://huggingface.co/kisejin/TopicModelingRepo/resolve/5ecdc19ebac471cb51415c4e2fa755d81931c0ee/BERTopic/tests/test_plotting/test_heatmap.py
677 Bytes
| import copy | |
| import pytest | |
| def test_heatmap(model, request): | |
| topic_model = copy.deepcopy(request.getfixturevalue(model)) | |
| topics = set(topic_model.topics_) | |
| if -1 in topics: | |
| topics.remove(-1) | |
| fig = topic_model.visualize_heatmap() | |
| fig_topics = [int(topic.split("_")[0]) for topic in fig.to_dict()["data"][0]["x"]] | |
| assert set(fig_topics) == topics | |