Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedding Visualizer

A CLI tool that visualizes text embeddings in 2D/3D space using interactive Plotly charts.

Features

  • Multiple Embedding Models: Supports any SentenceTransformer model
  • Dimensionality Reduction: PCA, t-SNE, or UMAP
  • 2D/3D Visualization: Switch between 2D and 3D plots
  • Interactive Output: Standalone HTML with hover information
  • File or Text Input: Process text files or direct input

Installation

pip install -r requirements.txt

Usage

Basic usage with direct text:

python visualize.py "text 1" "text 2" "text 3" --output viz.html

Using a text file (one text per line):

python visualize.py --file examples/sample_texts.txt --output viz.html

With different model and method:

python visualize.py --file texts.txt --model all-mpnet-base-v2 --method umap --dim 3 --output viz_3d.html

Options

  • --model, -m: Sentence transformer model (default: all-MiniLM-L6-v2)
  • --method, -M: Reduction method: pca, tsne, or umap (default: pca)
  • --dim, -d: Output dimensions: 2 or 3 (default: 2)
  • --output, -o: Output HTML file (default: embeddings_viz.html)
  • --file, -f: Input file with texts (one per line)

Example

# Create sample texts
echo -e "Machine learning is great\nPython is awesome\nData science is fun" > texts.txt

# Visualize with t-SNE
python visualize.py --file texts.txt --method tsne --output ml_viz.html

# Open the visualization
xdg-open ml_viz.html  # Linux
open ml_viz.html      # macOS

Requirements

  • Python 3.7+
  • See requirements.txt for dependencies

License

MIT

About

CLI tool that visualizes text embeddings in 2D/3D space

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages