Skip to content

feat: dimension reduction algorithm selection (UMAP / PCA / t-SNE)#24

Merged
aGallea merged 5 commits into
masterfrom
feat/reduction-algorithm-selection
Mar 2, 2026
Merged

feat: dimension reduction algorithm selection (UMAP / PCA / t-SNE)#24
aGallea merged 5 commits into
masterfrom
feat/reduction-algorithm-selection

Conversation

@aGallea

@aGallea aGallea commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #10

Allow users to choose between t-SNE, UMAP, and PCA dimensionality reduction algorithms for the 3D scatter plot, with algorithm-specific parameter controls across backend and frontend.

Changes

  • Settings (settings.py, pyproject.toml): Add 6 new env-configurable fields (REDUCTION_ALGORITHM, TSNE_PERPLEXITY, TSNE_LEARNING_RATE, UMAP_N_NEIGHBORS, UMAP_MIN_DIST, UMAP_METRIC). UMAP is an optional dependency (uv sync --extra umap).
  • Core logic (scatter_plot.py): Add reduce_dimensions() with strategy dispatch for tsne/umap/pca. UMAP import is guarded with a friendly error when not installed.
  • API (models.py, routes/plot.py): Extend PlotRequest with reduction algorithm and params, with field validation for algorithm-specific param constraints.
  • Frontend (PlotControls.tsx, plotStore.ts, types/index.ts): Radio selector for t-SNE/UMAP/PCA with conditional parameter panels (sliders, dropdowns) that only show for the selected algorithm.
  • Docs (README.md): Updated features, architecture diagram, Plot parameter table, and UMAP install instructions.

Testing

  • 208 tests passing, 97.3% coverage (threshold: 70%)
  • 8 new tests for reduce_dimensions() (all algorithms, custom params, import guard, invalid algorithm)
  • 6 new tests for settings defaults and env var parsing
  • All pre-existing tests updated to mock the new reduce_dimensions function
  • mypy strict: 0 errors
  • ruff lint + format: clean
  • Frontend build (tsc + vite): clean

aGallea and others added 5 commits March 1, 2026 17:22
Add pydantic-settings fields for reduction_algorithm (tsne/umap/pca),
tsne_perplexity, tsne_learning_rate, umap_n_neighbors, umap_min_dist,
and umap_metric. Add umap-learn as optional dependency group. Include
mypy override for umap stubs.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add reduce_dimensions() function supporting t-SNE, UMAP, and PCA with
strategy dispatch. Refactor compute_plot_data() to use the new function.
UMAP import is guarded with a friendly error message when not installed.
Includes 8 new tests covering all algorithms, custom params, import
guard, and invalid algorithm handling.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Extend PlotRequest model with reduction_algorithm field (tsne/umap/pca)
and algorithm-specific parameters with field_validator for mutual
exclusivity. Update plot route to pass reduction params to Settings.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add ReductionAlgorithm type and algorithm params to PlotRequest interface.
Extend plotStore with algorithm state and setters. Add radio selector
for t-SNE/UMAP/PCA with conditional parameter panels: perplexity slider
and learning rate dropdown for t-SNE, neighbors/min-dist sliders and
metric dropdown for UMAP, and info text for PCA.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Document t-SNE/UMAP/PCA algorithm selection in features, architecture
diagram, and Plot parameters table. Add UMAP optional installation
instructions and new env var reference for all 6 reduction parameters.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions

github-actions Bot commented Mar 1, 2026

Copy link
Copy Markdown

Tests Report 📄

Tests Succees ✅

JUnit Details

Total Tests Failures Errors Skipped Time ⏳
209 0 0 0 60.24s

Coverage Details (91% >= 90%) ✅

Diff Cover Details
FileCovered LinesMissing Lines
embedding_cluster/scatter_plot.py62/6694%267-270
embedding_cluster/settings.py10/10100%
embedding_cluster/server/models.py16/2176%86-88,92-93
embedding_cluster/server/routes/plot.py6/6100%
Total94/10391%

@aGallea aGallea merged commit d3300e0 into master Mar 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Dimension Reduction Algorithm Selection (UMAP / PCA / t-SNE)

1 participant