MaartenGr / MaartenGr/BERTopic

Fewer topics than the number of articles

Open
#1,427 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hi, I am using the partial_fit function to generate topics continuously. However at some batches the number of topics could be a bit fewer than the number of articles in the dataset. I have checked the "labels" attribute in "partial_fit" and it returns exactly the same topics as articles, but when I called "model.topics_" after BERTopic it returns fewer topics. How could this happen and what can I do to solve it? Or at least, can I know which articles did not get assigned a topic? I can drop them directly as there are usually only 2 or 3 articles with missing topics. Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with BERTopic.partial_fit, comparing its labels attribute with model.topics_ after processing batches. Read the partial_fit and topics_ entry points referenced in the issue, then determine why articles may be missing and how those articles can be identified; done means a documented explanation or a verified fix with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.