feat: support pre-computed UMAP embeddings via umap_embeddings parameter [stacks on #2515]#2517
Draft
pidefrem wants to merge 2 commits into
Draft
feat: support pre-computed UMAP embeddings via umap_embeddings parameter [stacks on #2515]#2517pidefrem wants to merge 2 commits into
umap_embeddings parameter [stacks on #2515]#2517pidefrem wants to merge 2 commits into
Conversation
umap_embeddings parameterumap_embeddings parameter [stacks on #2515]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
feat: support pre-computed UMAP embeddings via
umap_embeddingsparameterBERTopic always computes UMAP internally. While
BaseDimensionalityReductionlets users skip UMAP entirely, there's no way to reuse specific UMAP embeddings from a previous run — which is needed for hyperparameter grid search (same UMAP, different HDBSCAN settings) and cross-session caching.Changes:
Add a
umap_embeddingsparameter tofit(),fit_transform(), andtransform(). When provided, skip the UMAP computation and use the given embeddings directly. The UMAP model is still stored (for.transform()on new data) but not called during that fit.All new parameters default to
None— existing code unchanged.This is complementary to
BaseDimensionalityReduction, not a replacement: it reuses specific UMAP embeddings without replacing the UMAP model.Fixes #2504
Before submitting