emb_diversity.plot package

Submodules

Utilities for visualization functions.

Visualize embedding spaces. Assumes that embeddings are numeric.

emb_diversity.plot.visualize.plot_2d(embeddings, method='pca', *, tsne_perplexity=30.0, tsne_lr=200.0, umap_n_neighbors=15, umap_min_dist=0.1, labels=None)[source]
Return type:

Tuple[Figure, Axes]

emb_diversity.plot.visualize.plot_3d(embeddings, method='pca', *, point_size=4, tsne_perplexity=30.0, tsne_lr=200.0, umap_n_neighbors=15, umap_min_dist=0.1, labels=None)[source]

Create an interactive 3D projection of embedding matrices.

Generate a 3D visualization using PCA, t‑SNE, or UMAP. All embedding matrices are projected jointly and displayed using Plotly.

Parameters:
  • embeddings (Iterable[ndarray] | ndarray) – A numpy array of shape (n, d) or a list of such arrays. Each array must be 2‑dimensional.

  • method (str) – Dimensionality reduction method. One of {“pca”, “tsne”, “umap”}.

  • point_size (int) – Marker size for the 3D scatter plot.

  • tsne_perplexity (float) – Perplexity parameter for t‑SNE.

  • tsne_lr (float) – Learning rate for t‑SNE.

  • umap_n_neighbors (int) – Number of neighbors for UMAP.

  • umap_min_dist (float) – Minimum distance parameter for UMAP.

  • labels (list[str] | None) – (Optional) names for each dataset as shown in the legend.

Return type:

Figure

Returns:

A Plotly Figure containing the interactive 3D scatter plot.

Raises:
  • TypeError – If embeddings is not an array or iterable of arrays.

  • ValueError – If any embedding array is not 2‑dimensional.

Example

fig = plot_3d(embeddings, method=”pca”) fig.write_html(“projection.html”)

Module contents