Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the 6 steps of BERTopic #2204

Open
1 task done
TalaN1993 opened this issue Nov 4, 2024 · 6 comments
Open
1 task done

the 6 steps of BERTopic #2204

TalaN1993 opened this issue Nov 4, 2024 · 6 comments

Comments

@TalaN1993
Copy link

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Desribe the bug

Hello,

I have a question. According to the document, I understand that BERT-Topic consists of six steps, with the representation tuning step being optional. I have read many articles in a specific field that used BERTopic, but my question is why they don’t all include these five steps. For example, some articles only include embedding, dimension reduction, clustering, and weighting scheme (c-TF-IDEF). I’d like to know if each step can be omitted and whether using all five remaining steps is necessarily required?,

Reproduction

from bertopic import BERTopic

BERTopic Version

0.16.3

@TalaN1993 TalaN1993 added the bug Something isn't working label Nov 4, 2024
@MaartenGr MaartenGr removed the bug Something isn't working label Nov 5, 2024
@MaartenGr
Copy link
Owner

For example, some articles only include embedding, dimension reduction, clustering, and weighting scheme (c-TF-IDEF).

These are actually five steps:

  • Embedding
  • Dim reduction
  • Clustering
  • Tokenization
  • c-TF-IDF

Although tokenization isn't mentioned, it is definitely used.

Typically, you would see those five steps with the optional representation step. If you would want to remove a step, the only that you could potentially remove is the dimensionality reduction step. All other are needed.

Many papers just implement the basic BERTopic functionality and compare it with that, which is a shame considering the representation models often improve the output significantly. I can't say their reasoning, but I wished the representing step would be included more often.

@TalaN1993
Copy link
Author

Thank you so much for your help and guidance.

@TalaN1993
Copy link
Author

TalaN1993 commented Nov 7, 2024

Hello MaartenGr,

In my case, I used all six steps with three different respresentation models (gpt 3.5, MMR and KeyBert) with the same other five steps. I evaluated the result using OCTIS npmi and topic diversity., but the result was somewhat different from what I expected. Do you think it makes sense?,

with gpt 3.5 : (npmi_score: 0.1267 , diversity : 0.9851)
with MMR : (npmi_score: 0.2625 , diversity : 0.7263)
with KeyBERT: (npmi_score: 0.3027 , diversity : 0.6421)

I had intended for the NPMI value for gpt to be higher.

@MaartenGr
Copy link
Owner

It may be worthwhile to do a deep-dive into how topic coherence (and diversity) metrics work. They assume we have a list of keywords as the main representation for topics. This is true for MMR and KeyBERT but not for GPT-3.5 since that only generates a single label and not a mixture of words.

@TalaN1993
Copy link
Author

Hello MaartenGr,
I have a question. I understand that in LDA, the input data is typically based on the Bag of Words (BoW) representation. My question is: if we change the vector representation from BoW to TF-IDF or SentenceTransformers and then feed it to the LDA model, does this approach make sense? I am looking for ways to improve the results of LDA.

@MaartenGr
Copy link
Owner

@TalaN1993 LDA is quite a different method compared to BERTopic and I don't think it would work that easily with embeddings without any significant changes. I believe there is something called LDA2Vec or something similar that you could research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants