feat: dimension reduction algorithm selection (UMAP / PCA / t-SNE)#24
Merged
Conversation
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>
Tests Report 📄Tests Succees ✅JUnit Details
Coverage Details (91% >= 90%) ✅Diff Cover Details
|
||||||||||||||||||||||||||||||||||
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.
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.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).scatter_plot.py): Addreduce_dimensions()with strategy dispatch for tsne/umap/pca. UMAP import is guarded with a friendly error when not installed.models.py,routes/plot.py): ExtendPlotRequestwith reduction algorithm and params, with field validation for algorithm-specific param constraints.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.README.md): Updated features, architecture diagram, Plot parameter table, and UMAP install instructions.Testing
reduce_dimensions()(all algorithms, custom params, import guard, invalid algorithm)reduce_dimensionsfunction