localvectordb.visualization.dimensionality module
Dimensionality reduction utilities (PCA, t-SNE).
- localvectordb.visualization._dimensionality.reduce_dimensions(embeddings: ndarray, method: str = 'tsne', n_components: int = 2, doc_ids: List[str] | None = None, **kwargs) EmbeddingProjection
Project high-dimensional embeddings into a lower-dimensional space.
- Parameters:
- Return type:
- localvectordb.visualization._dimensionality.project_new_points(projection: EmbeddingProjection, new_embeddings: ndarray) ndarray
Project new points into an existing reduced space.
For PCA this uses the fitted transform directly. For t-SNE the stored PCA fallback is used (t-SNE cannot transform unseen data).
- Parameters:
projection (EmbeddingProjection) – Previously fitted projection.
new_embeddings (np.ndarray) – (M, D) new embeddings to project.
- Returns:
(M, n_components) projected coordinates.
- Return type:
np.ndarray