You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turftopic now allows you to automatically assign human readable names to topics using LLMs or n-gram retrieval!
133
136
137
+
> You will need to `pip install "turftopic[openai]"` for this to work.
138
+
134
139
```python
135
140
from turftopic import KeyNMF
136
141
from turftopic.namers import OpenAITopicNamer
@@ -154,6 +159,8 @@ model.print_topics()
154
159
155
160
You can use a set of custom vectorizers for topic modeling over **phrases**, as well as **lemmata** and **stems**.
156
161
162
+
> You will need to `pip install "turftopic[spacy]"` for this to work.
163
+
157
164
```python
158
165
from turftopic import BERTopic
159
166
from turftopic.vectorizers.spacy import NounPhraseCountVectorizer
@@ -175,10 +182,34 @@ model.print_topics()
175
182
176
183
### Visualization
177
184
178
-
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)
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.
179
210
180
211
```bash
181
-
pip install topic-wizard
212
+
pip install "turftopic[topic-wizard]"
182
213
```
183
214
184
215
By far the easiest way to visualize your models for interpretation is to launch the topicwizard web app.
abstract = "BERT (Devlin et al., 2018) and RoBERTa (Liu et al., 2019) has set a new state-of-the-art performance on sentence-pair regression tasks like semantic textual similarity (STS). However, it requires that both sentences are fed into the network, which causes a massive computational overhead: Finding the most similar pair in a collection of 10,000 sentences requires about 50 million inference computations ({\textasciitilde}65 hours) with BERT. The construction of BERT makes it unsuitable for semantic similarity search as well as for unsupervised tasks like clustering. In this publication, we present Sentence-BERT (SBERT), a modification of the pretrained BERT network that use siamese and triplet network structures to derive semantically meaningful sentence embeddings that can be compared using cosine-similarity. This reduces the effort for finding the most similar pair from 65 hours with BERT / RoBERTa to about 5 seconds with SBERT, while maintaining the accuracy from BERT. We evaluate SBERT and SRoBERTa on common STS tasks and transfer learning tasks, where it outperforms other state-of-the-art sentence embeddings methods."
171
171
}
172
172
173
-
@software{topicwizard,
174
-
author = {Kardos, Márton},
175
-
month = nov,
176
-
title = {{topicwizard: Pretty and opinionated topic model visualization in Python}},
Copy file name to clipboardExpand all lines: paper.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,8 @@ bibliography: paper.bib
34
34
35
35
# Summary
36
36
37
-
Turftopic is a topic modelling library including a number of recent topic models that go beyond bag-of-words models and can understand text in context, utilizing representations from transformers.
37
+
Topic models are machine learning techniques that are able to discover themes in a set of documents.
38
+
Turftopic is a topic modelling library including a number of recent developments in topic modelling that go beyond bag-of-words models and can understand text in context, utilizing representations from transformers.
38
39
Turftopic focuses on ease of use, providing a unified interface for a number of different modern topic models, and boasting both model-specific and model-agnostic interpretation and visualization utilities.
39
40
While the user is afforded great flexibility in model choice and customization, the library comes with reasonable defaults, so as not to needlessly overwhelm first-time users.
40
41
In addition, Turftopic allows the user to: a) model topics as they change over time, b) learn topics on-line from a stream of texts, c) find hierarchical structure in topics, d) learning topics in multilingual texts and corpora.
@@ -50,10 +51,11 @@ Some attempts have been made at creating unified packages for modern topic model
50
51
These packages, however, have a focus on neural models and topic model evaluation, have abstract and highly specialized interfaces, and do not include some popular topic models.
51
52
Additionally, while model interpretation is fundamental aspect of topic modelling, the interpretation utilities provided in these libraries are fairly limited, especially in comparison with model-specific packages, like BERTopic.
52
53
53
-
Turftopic unifies state-of-the-art contextual topic models under a superset of the `scikit-learn`[@scikit-learn] API, which users are likely already familiar with, and can be readily included in `scikit-learn` workflows and pipelines.
54
+
Turftopic unifies state-of-the-art contextual topic models under a superset of the `scikit-learn`[@scikit-learn] API, which many users may be familiar with, and can be readily included in `scikit-learn` workflows and pipelines.
54
55
We focused on making Turftopic first and foremost an easy-to-use library that does not necessitate expert knowledge or excessive amounts of code to get started with, but gives great flexibility to power users.
55
-
Furthermore, we included an extensive suite of pretty-printing and visualization utilities that aid users in interpreting their results.
56
-
The library also includes three topic models, which to our knowledge only have implementations in Turftopic, these are: KeyNMF [@keynmf], Semantic Signal Separation (S^3^) [@s3], and GMM, a Gaussian Mixture model of document representations with a soft-c-tf-idf term weighting scheme.
56
+
Furthermore, we included an extensive suite of pretty-printing and model-specific visualization utilities that aid users in interpreting their results.
57
+
In addition, we provide native compatibility with `topicwizard`[@topicwizard], a model-agnostic topic model visualization library.
58
+
The library also includes three topic models that, to our knowledge, only have implementations in Turftopic: KeyNMF [@keynmf], Semantic Signal Separation (S^3^) [@s3], and GMM, a Gaussian Mixture model of document representations with a soft-c-tf-idf term weighting scheme.
0 commit comments