MaartenGr / MaartenGr/BERTopic

How `update_topics` re-computes or re-assigns probabilities?

Open
#1,387 4 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

After getting topics, I need to split them based on internal labels. Doing so, I'll need to use `update_topics` with a custom list of topics. But `update_topics` function does not update `probabilities_` anymore. Later I'll need a probability assigned to each document in my pipeline.

While documentations [point out](https://github.com/MaartenGr/BERTopic/blob/94064441233564f29b5ac03ff5c38669067ba4e1/bertopic/_bertopic.py#L1356C6-L1356C6) that `update_topics` can get custom topics but it doesn't seem to be coherently changing all the states. Am I missing something here?

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 with the documented update_topics entry point in bertopic/_bertopic.py around line 1356, then trace how custom topics and probabilities_ are handled. Reproduce the reported sequence of getting topics, assigning a custom topic list, and requesting document probabilities. Done means the relationship between update_topics and probabilities_ is consistent or the documentation clearly states the limitation.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.