MaartenGr / MaartenGr/BERTopic

Systematic test units for fit_transform()

Open
#2,206 9 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

### Feature request

As identified in PR #2191, the current test units do not cover the _process_ of fitting a model. In other words, is not testing the implementation of `fit_transform()`. Consequently, different current, and future, features that are performed at the `fit_transform()` level are not tested in any systematic way. We realized about this when [debugging topic reduction by declaring a `nr_topics` for the model before fitting](https://github.com/MaartenGr/BERTopic/pull/2191). However, this issue might involve all the core features, and most of the optional ones.

Currently, in [conftest.py](https://github.com/MaartenGr/BERTopic/blob/master/tests/conftest.py) the tests define the models and `fit`them for further testing in the other units.
https://github.com/MaartenGr/BERTopic/blob/c3ec85dec8eeac704b30812dfed4ac8cd7d13561/tests/conftest.py#L50C1-L55C17

As such, some improvement is required for the tests to cover for the `fit_transform()` method, the core of the library.

### Motivation

This is required to systematically test the internal consistency of all features and the overall work pipeline.

### Your contribution

I can't tackle this issue yet due to time availability, since I will need to familiarize myself more with the pytest framework first. I will come back in a future to tackle this, but I leave the issue open as a reminder, and in case someone else is up for the challenge.

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 tests/conftest.py, especially the model setup around lines 50-55, and review PR #2191 and the topic-reduction case involving nr_topics before fitting. Inspect the existing test units and extend coverage so the fit_transform() process is tested systematically across the core and relevant optional features.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, testing-qa
Issue type
Feature
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.