Skip to content

Commit bd0eb49

Browse files
Added more details on visualization in readme
1 parent aded872 commit bd0eb49

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,34 @@ model.print_topics()
182182

183183
### Visualization
184184

185-
Turftopic does not come with built-in visualization utilities, [topicwizard](https://github.com/x-tabdeveloping/topicwizard), an interactive topic model visualization library, is compatible with all models from Turftopic.
185+
Turftopic comes with a number of visualization and pretty printing utilities for specific models and specific contexts, such as hierarchical or dynamic topic modelling.
186+
You will find an overview of these in the [Interpreting and Visualizing Models](https://x-tabdeveloping.github.io/turftopic/model_interpretation/) section of our documentation.
187+
188+
```
189+
pip install "turftopic[datamapplot, openai]"
190+
```
191+
192+
```python
193+
from turftopic import ClusteringTopicModel
194+
from turftopic.namers import OpenAITopicNamer
195+
196+
model = ClusteringTopicModel(feature_importance="centroid").fit(corpus)
197+
198+
namer = OpenAITopicNamer("gpt-4o-mini")
199+
model.rename_topics(namer)
200+
201+
fig = model.plot_clusters_datamapplot()
202+
fig.show()
203+
```
204+
205+
<center>
206+
<img src="https://github.com/x-tabdeveloping/turftopic/blob/main/docs/images/cluster_datamapplot.png?raw=true" width="70%" style="margin-left: auto;margin-right: auto;">
207+
</center>
208+
209+
In addition, Turftopic is natively supported in [topicwizard](https://github.com/x-tabdeveloping/topicwizard), an interactive topic model visualization library, is compatible with all models from Turftopic.
186210

187211
```bash
188-
pip install topic-wizard
212+
pip install "turftopic[topic-wizard]"
189213
```
190214

191215
By far the easiest way to visualize your models for interpretation is to launch the topicwizard web app.
@@ -196,10 +220,10 @@ import topicwizard
196220
topicwizard.visualize(corpus, model=model)
197221
```
198222

199-
<figure>
223+
<center>
200224
<img src="https://x-tabdeveloping.github.io/topicwizard/_images/screenshot_topics.png" width="70%" style="margin-left: auto;margin-right: auto;">
201225
<figcaption>Screenshot of the topicwizard Web Application</figcaption>
202-
</figure>
226+
</center>
203227

204228
Alternatively you can use the [Figures API](https://x-tabdeveloping.github.io/topicwizard/figures.html) in topicwizard for individual HTML figures.
205229

0 commit comments

Comments
 (0)