BERTopic icon indicating copy to clipboard operation
BERTopic copied to clipboard

Replacing cTF-IDF with other topic word extraction algorithms

Open Syarotto opened this issue 4 years ago • 2 comments

Hi! I wonder if it's possible to replace cTF-IDF with other topic word extraction algorithms like finding closest words to the cluster centroid as used in top2vec, and if so, whether there're some pointers on which functions to look at. I've located BERTopic._extract_topics() for the scoring part, but I'm not sure vectors can be accessed to calculate similarities. Much appreciated!

Syarotto avatar Aug 17 '22 18:08 Syarotto

That is currently not possible as these two topic extraction methods are quite different from one another. Most functions and variations of BERTopic are dependent on a bag of words representation. Moreover, due to the density-based nature of HDBSCAN, there was purposefully chosen for a technique that makes no assumptions with respect to the structure not a cluster/topic. Having said that, I am working on a new version of BERTopic that allows you to use any variation of c-TF-IDF instead, which should be a step in the right direction.

MaartenGr avatar Aug 17 '22 20:08 MaartenGr

That's super helpful, thank you!

Syarotto avatar Aug 23 '22 21:08 Syarotto