Fix topic_sizes_ not updated in zero-shot topic modeling (#2384)
What does this PR do?
Minor fix to fit_transform() to fix the issue of topic_sizes_ not being updated in zero-shot topic modeling when using the nr_topics parameter. Adds tests to confirm the fix and provides a small changelog update.
Happy to revise further if any revisions are desired.
Fixes #2384
Before submitting
- [ ] This PR fixes a typo or improves the docs (if yes, ignore all other checks!).
- [x] Did you read the contributor guideline?
- [x] Was this discussed/approved via a Github issue? Please add a link to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes (if applicable)?
- [x] Did you write any new necessary tests?
Thank you for the PR! With respect to the tests, can you explain a bit more on why those were added like this? Specifically, I'm seeing UMAP parameters sometimes being added whilst that is not the case for every test. Moreover, there are several calls to BERTopic, which can be quite expensive in a testing pipeline especially if you could run it once instead. There are conftest available where you can initialize a given model once and re-use it across tests:
https://github.com/MaartenGr/BERTopic/blob/master/tests/conftest.py