Repository navigation
Add production-ready fold-mean Optuna search - #139
Open
cornelislouisa wants to merge 5 commits into
Open
cornelislouisa wants to merge 5 commits into
cornelislouisa wants to merge 5 commits into
Conversation
The baselines were not comparable to the GNNs in two ways. Hyperparameters were tuned independently inside each fold, so two folds of the same cell could be reported under different hyperparameters. That is not what the GNN side does: an Optuna trial evaluates one configuration across the whole rotation and is scored on the mean. A per-fold winner also reports the best of several draws from a noisy validation estimate, which flatters the baseline. Selection now happens once per cell. Every grid candidate is scored on every fold's validation split, the candidate with the highest mean wins, and all five folds are refit and evaluated with that single configuration. Ties resolve by grid order, matching GridSearchCV. The choice does not depend on which fold's job computes it, so it is cached under a fold-independent key and the remaining jobs reuse it. Refitting still uses training data only, and test data never takes part in selection. The feature sets also differed. Baselines ran SelectKBest on top of whatever columns they were given, while the GNNs consume nodes chosen by variance, correlation, distance correlation, or random sampling against the training split. Any accuracy gap was partly a feature-selection artifact. Baselines now reproduce the GNN node selection directly, including the node budget and the RNG seeding that makes method=random reproducible, and SelectKBest is gone from the dataset configs. verify_baseline_features.py checks this against the parquet artifacts the GNN pipeline writes. Within one job the folds are built once and shared between SVM and elastic net. Rebuilding per baseline meant running the distance-correlation scan over every gene twice. Selection is enabled by baseline_hparam_selection in configs/baseline.yaml and applies only to k-fold runs. Fixed splits, and anyone who sets per_fold, keep the previous behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Training graphs were binarized with a per-dataset adjacency_threshold copied from an old explorer sweep. Those cutoffs do not keep a fixed edge density once the train fold, node set, or corrections change, so graphs that were supposed to be comparable were not. WGCNA training now requires adjacency_target_connectivity and keeps the strongest train-fold edges nearest to that density. STRING still uses adjacency_threshold. There is no silent fallback from one to the other. The stats explorer still sweeps a cutoff, and it has to say so with wgcna_binarization=fixed_threshold. Cache directories follow the setting that actually built the graph, so a density-targeted WGCNA cache cannot be reused as a cutoff cache. Co-authored-by: Cursor <cursoragent@cursor.com>
…y' into guille/production-optuna
Add a resumable Optuna launcher that keeps experimental ablations outside the search space and evaluates every sampled configuration across the complete validation-fold rotation. Persist studies and individual fold attempts so interrupted jobs resume without repeating successful folds. Run training in isolated subprocesses with deterministic GPU assignment, one CPU thread, and machine-readable objective and metric payloads. Pin the Optuna 2.x and SQLAlchemy 1.x combination used by the storage layer. Make STRING cache construction safe under parallel cache warmup with per-artifact file locks, atomic gzip and JSON writes, validation, and corrupt-cache recovery. Default all six datasets to the five-fold protocol and document the supported search workflow in the README. Keep the public surface focused on reusable production and smoke configs; campaign snapshots, evaluation scripts, plotting, and runbooks remain out of this change. Co-authored-by: Cursor <cursoragent@cursor.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
Add the supported production path for resumable, multi-GPU Optuna searches over the omics benchmark.
Each outer ablation cell is its own study. A trial samples one model configuration and evaluates that exact configuration over all five validation folds. The objective is the arithmetic mean across folds; test folds never participate in selection.
Search runtime
The reusable multi-dataset and smoke configs use relative paths. There are no personal scratch paths or W&B entities in the committed configs.
Parallel STRING safety
Parallel cache warmup can otherwise leave truncated gzip files or partially written JSON. STRING cache construction now uses:
os.replaceThis changes cache I/O only, not graph semantics.
Protocol and documentation
All six omics dataset configs now default to the five-fold rotation (
split_type: k-fold,k: 5). The README documents fold behavior, train-only graph construction, WGCNA target connectivity vs STRING cutoff, Optuna studies/trials/retries/shards, baseline selection, and portable launch commands.Dependency compatibility
The storage code uses Optuna 2.x, which is incompatible with SQLAlchemy 2.x.
pyproject.tomlnow pins:optuna>=2.10.0,<3.0.0sqlalchemy>=1.3.0,<2.0.0Persistence/resume tests were run with Optuna 2.10.1 and SQLAlchemy 1.4.54.
Verification
Scope
Intentionally excluded: Sep24 campaign configs,
.gitignore, status/rebalance tooling, test-evaluation/checkpoint scripts, plotting, W&B result aggregation, runbooks/guides, and generated output files.PR dependency
This branch was built on the temporary combined state of #137 and #138 so their reviewed behavior could be tested together. After those two PRs merge, this branch should be rebased onto updated
main; the remaining diff will be this Optuna/STRING/k-fold/README change only.