-
Notifications
You must be signed in to change notification settings - Fork 764
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
Custom labels in dynamic modeling and topic per class #2154
Comments
This might be because |
Thanks for the explanation. I understand your suggestion from a programming point of view. In addition, however, as a user, I would prefer that there was parameter in topics_per_class(), like custom_labels=TRUE to create the df with custom labels. I would prefer that because I think analyzing the tables is much better than the visual. I can highlight things, take notes etc. Would adding such a parameter be a bad idea, if so why? Or maybe there is a way that I did not figure out yet. Or what is the proper method to create the table with the custom labels while using dynamic modeling or topic per class? |
I think the reason something like is not implemented is because you can add that information yourself since you have access to the custom labels (e.g., topics_per_class["Custom_Label"] = topics_per_class.apply(lambda row: topic_model.custom_labels_[row["Topic"]], axis=1) I haven't tested this line but you should get the general intention. |
Thanks! |
Have you searched existing issues? 🔎
Desribe the bug
Hi,
I’ve come across a small issue that’s left me a bit puzzled. I’m not entirely sure if it’s a bug, but it does seem confusing. When I run topics_per_class with my topic model:
topics_per_class = topic_model.topics_per_class(docs, classes=classes, global_tuning=False)
The resulting topics_per_class looks like this:
Topic | Words | Frequency | Class
-1 | jaar, mensen, zegt, vrouwen, politie | 1421 | nl
This has no custom_labels. That is not ideal but OK.
But when I run this
fig = topic_model.visualize_topics_per_class(topics_per_class, custom_labels=True)
Then rerun topics_per_class in my jupyter, I get now this:
| Topic | Words | Frequency | Class | Name
-1 | jaar, mensen, zegt, vrouwen, politie | 1421 | nl | -1_mensen_vrouwen_politie_kinderen
Now the "Name" is added. It’s unclear why it isn’t already included or why there’s no parameter like custom_labels=True when creating topics_per_class. I checked the documentation, and this parameter doesn’t exist, and attempting to use it gives an error in the first step.
I just wanted to bring this up. As title indicates, I’ve also experienced the same issue with dynamic topic modeling as well.
I sometimes find the table version easier to use, so I’m curious why it works like this, or maybe I’m missing something?
This is only my second time reporting something (on GitHub in general), so I hope I explained it clearly. Thanks again for everyone’s work and effort on BERTopic.
Best,
Reproduction
BERTopic Version
0.16.2
The text was updated successfully, but these errors were encountered: