feat: support multiple DR parameter sets in a single prepare run#48
Merged
Conversation
Allow inline per-method parameter overrides in the -m flag using colon syntax with semicolon-separated params. This enables comparing the same DR method with different parameters in a single run without re-running the full pipeline. Example: -m "umap2:n_neighbors=15" -m "umap2:n_neighbors=50" -m pca2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Centralize the param-suffix rule used by ReductionPipeline._run_reductions into a single helper so cli/project.py can share it (follow-up commit). Includes a regression test for the mixed plain+override case (`-m umap2 -m umap2:n_neighbors=50`) which currently emits "ProtT5 — UMAP 2" and "ProtT5 — UMAP 2 (n=50)". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add _run_with_overridden_config(base, effective_params, method, dims, data) to pipeline.py to centralize the save/restore pattern for BaseProcessor.config. A leaked `precomputed` flag (or any temporary key) can no longer survive across reduction calls. - Update ReductionPipeline._run_reductions and cli/project.py to use both the new helper and disambiguation_suffix. cli/project.py previously set base.config without restoring it; this is now handled in one place. - Hoist the lazy in-test imports added in the previous commit to the top-level import block in tests/test_pipeline_utils.py. Addresses PR #48 review feedback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The precomputed-MDS branch in _run_reductions was the last call site still mutating self.base.config in place (set precomputed=True, then pop() after). Migrate it to _run_with_overridden_config so: - The save/restore pattern is consistent across all reduction call sites. - A precomputed flag can no longer survive in base.config if process_reduction raises mid-call. Regression tests cover both the happy path (flag is set during reduction, cleared after) and the exception path (flag is cleared even when reduction raises). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
martinpycha
pushed a commit
to d0rr4/PP1
that referenced
this pull request
May 20, 2026
- Add _run_with_overridden_config(base, effective_params, method, dims, data) to pipeline.py to centralize the save/restore pattern for BaseProcessor.config. A leaked `precomputed` flag (or any temporary key) can no longer survive across reduction calls. - Update ReductionPipeline._run_reductions and cli/project.py to use both the new helper and disambiguation_suffix. cli/project.py previously set base.config without restoring it; this is now handled in one place. - Hoist the lazy in-test imports added in the previous commit to the top-level import block in tests/test_pipeline_utils.py. Addresses PR tsenoner#48 review feedback. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
martinpycha
pushed a commit
to d0rr4/PP1
that referenced
this pull request
May 20, 2026
feat: support multiple DR parameter sets in a single prepare run
martinpycha
pushed a commit
to d0rr4/PP1
that referenced
this pull request
May 20, 2026
Follow-up to PR tsenoner#48 review feedback. - docs/cli.md: rewrite -m flag description to spell out the comma-vs-semicolon rule explicitly, add an "Overridable parameters" subsection listing the 11 valid override keys with their abbreviations and types, and extend "Projection Naming" with an example of the parameter-suffix disambiguation behavior. - notebooks/ProtSpace_Preparation.ipynb: insert an informational markdown cell pointing power users at the CLI for parameter sweeps, since the toggle UI runs each method only once. No code or behavior changes; release-bot will not bump the version. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 #46.
-mflag:-m "umap2:n_neighbors=50;min_dist=0.1"-mis now repeatable:-m "umap2:n_neighbors=15" -m "umap2:n_neighbors=50" -m pca2ProtT5 — UMAP 2 (n=50))prepareandprojectcommands support the new syntaxNew types
MethodSpecfrozen dataclass:(method, dims, overrides)— replaces bare stringsparse_methods_arg(): parses repeatable-mwith comma+colon+semicolon syntaxFiles changed
pipeline.py—MethodSpec,parse_method_spec(),parse_methods_arg(),_run_reductions(), cache helpersembedding_set.py—format_param_suffix(), extendedformat_projection_name()common_options.py—Opt_Methodschanged fromstrtolist[str] | Noneprepare.py,project.py— wired up new parsingdocs/cli.md,CLAUDE.md, notebook — documentation updatedtest_pipeline_utils.py— 29 new tests (41 → 70)Test plan
uv run pytest tests/ -m "not slow")-m pca2,umap2works unchanged-m "umap2:n_neighbors=15" -m "umap2:n_neighbors=50" -m pca2produces 3 projections with correct namesProtT5 — UMAP 2 (n=15),ProtT5 — UMAP 2 (n=50),ProtT5 — PCA 2🤖 Generated with Claude Code