From c92b495ba593715a13e9895ea0554d5127997af9 Mon Sep 17 00:00:00 2001 From: Jonas Landsgesell Date: Wed, 3 Jan 2024 09:32:38 +0100 Subject: [PATCH 1/3] Update _bertopic.py to fix question/ github issue #1696 --- bertopic/_bertopic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index 22b6c03c..d29505ce 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -456,7 +456,10 @@ def transform(self, """ After having fit a model, use transform to predict new instances Arguments: - documents: A single document or a list of documents to predict on + documents: A single document or a list of documents to predict on. + Note that the behavior of the method might differ depending + on whether a single document or a list of documents is passed + (especially when using the HDBSCAN algorithm) embeddings: Pre-trained document embeddings. These can be used instead of the sentence-transformer model. images: A list of paths to the images to predict on or the images themselves From d63d38e3b3656174df240b6453fe618b82ec40c2 Mon Sep 17 00:00:00 2001 From: Jonas Landsgesell Date: Wed, 11 Feb 2026 12:57:22 +0100 Subject: [PATCH 2/3] Improve documentation for predict method arguments Clarify behavior of predict method with document types. Rewrote with Gemini --- bertopic/_bertopic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index d29505ce..c39a170a 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -458,8 +458,8 @@ def transform(self, Arguments: documents: A single document or a list of documents to predict on. Note that the behavior of the method might differ depending - on whether a single document or a list of documents is passed - (especially when using the HDBSCAN algorithm) + on whether a single document or a list of documents is passed, + particularly when using HDBSCAN, where this distinction is algorithm-specific. embeddings: Pre-trained document embeddings. These can be used instead of the sentence-transformer model. images: A list of paths to the images to predict on or the images themselves From 7929d06d5c4f059bc9f730e0bc078d3bf08ff3b5 Mon Sep 17 00:00:00 2001 From: Jonas Landsgesell Date: Wed, 11 Feb 2026 13:02:40 +0100 Subject: [PATCH 3/3] Take over suggestion from issue --- bertopic/_bertopic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index c39a170a..169d2f34 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -456,10 +456,10 @@ def transform(self, """ After having fit a model, use transform to predict new instances Arguments: - documents: A single document or a list of documents to predict on. - Note that the behavior of the method might differ depending - on whether a single document or a list of documents is passed, - particularly when using HDBSCAN, where this distinction is algorithm-specific. + documents: A single document or a list of documents for which to predict topic(s). + NOTE: When using HDBSCAN, predictions may differ depending on whether + a single document or a list of documents is provided, as HDBSCAN + leverages the presence of other data points during prediction. embeddings: Pre-trained document embeddings. These can be used instead of the sentence-transformer model. images: A list of paths to the images to predict on or the images themselves