BERTopic icon indicating copy to clipboard operation
BERTopic copied to clipboard

Create topic tree with custom labels

Open srikantamehta opened this issue 1 year ago • 5 comments

Hello, I am trying to print the topic tree to get a text based visualization of the hierarchy. Is there a way to replace the Parent_Name, Child_Left_Name, Child_Right_Name values form hierarchical_topics() with the CustomName's from the representation model?

srikantamehta avatar Nov 17 '23 18:11 srikantamehta

That is currently not possible since the custom label is only created for the topics found during .fit or .fit_transform, not the topics found using .hierarchical_topics. If there is enough interest, that can be included in a future release.

MaartenGr avatar Nov 17 '23 20:11 MaartenGr

Ah ok, that certainly would be a feature of interest, at least to me! Right now I'm using llama2 for the topic representation model so it might be possible to feed this tree back into it and get it to generate labels for the parents as well. Thanks for the reply!

srikantamehta avatar Nov 17 '23 20:11 srikantamehta

That is indeed a nice solution for now! Calculating multiple aspects might become tricky with multiple layers of hierarchy and methods of doing so but I'll make sure to definitely track this issue.

MaartenGr avatar Nov 17 '23 20:11 MaartenGr

That is currently not possible since the custom label is only created for the topics found during .fit or .fit_transform, not the topics found using .hierarchical_topics. If there is enough interest, that can be included in a future release.

Definitely interested!

linxule avatar Nov 17 '23 23:11 linxule

+1 from me!

zilch42 avatar Nov 21 '23 04:11 zilch42