Skip to content

Commit

Permalink
Fix #2100 (#2101)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenGr authored Aug 21, 2024
1 parent 510c15e commit 74bbc4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bertopic/_bertopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4495,11 +4495,11 @@ def _auto_reduce_topics(self, documents: pd.DataFrame, use_ctfidf: bool = False)
for key, val in sorted(mapped_topics.items()):
mappings[val].append(key)
mappings = {
topic_from: {
"topics_to": topics_to,
"topic_sizes": [self.topic_sizes_[topic] for topic in topics_to],
topic_to: {
"topics_from": topics_from,
"topic_sizes": [self.topic_sizes_[topic] for topic in topics_from],
}
for topic_from, topics_to in mappings.items()
for topic_to, topics_from in mappings.items()
}

# Update documents and topics
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def representation_topic_model(documents, document_embeddings, embedding_model):
@pytest.fixture(scope="session")
def reduced_topic_model(custom_topic_model, documents):
model = copy.deepcopy(custom_topic_model)
model.reduce_topics(documents, nr_topics=12)
model.reduce_topics(documents, nr_topics="auto")
return model


Expand Down

0 comments on commit 74bbc4f

Please sign in to comment.