Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2100 #2101

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bertopic/_bertopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4489,11 +4489,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