Skip to content

Share one STRING threshold and make shared caches safe under concurrency - #141

Open
cornelislouisa wants to merge 1 commit into
mainfrom
louisa/kfold-a-safe-defaults
Open

cornelislouisa wants to merge 1 commit into
mainfrom
louisa/kfold-a-safe-defaults

Conversation

@cornelislouisa

@cornelislouisa cornelislouisa commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

First of five stacked PRs that bring the k-fold work from guille/kfold_relaunch (the code behind the October k-fold results) into main.

Changes

  • STRING threshold. adjacency_threshold is 0.4 in every dataset config. WGCNA ignores it since Keep a target number of WGCNA edges instead of a frozen cutoff #138 (it uses adjacency_target_connectivity: 0.10), so the stale per-dataset WGCNA cutoffs and their "UPDATED" headers are removed. The searches already forced STRING to 0.4; this makes direct runs match. wgcna_binarization: target_connectivity is now stated explicitly (it was already the default).
  • STRING cache safety. Alias, bulk and interaction caches are locked per artifact, JSON is written atomically, truncated gzip downloads are re-downloaded, and corrupt cache JSON is rebuilt. Copied from kfold_relaunch.
  • Pre-transform cache safety. PreProcessor builds its cache under a directory lock and saves through a .partial file, so concurrent runs never read a half-written cache.
  • SAGN guard. gene_identity is rejected for SAGN, which trains on precomputed aggregates and would silently ignore the identity embedding.
  • Tests. The config consistency test now requires the same adjacency_threshold everywhere. test_string_cache_concurrency.py (from Add production-ready fold-mean Optuna search #139) covers the locks and atomic writes. A new gene-identity test covers the SAGN guard.
  • Docs. README graph-construction bullets give the WGCNA and STRING values, and ogbench/data/adjacency/README.md describes per-fold binarization.

Checks

  • pytest -m "not slow": 207 passed
  • pre-commit clean
  • 1-epoch runs: MotrPAC fixed and k-fold, BRCA STRING (graph built at 0.4), BRCA SAGN with gene_identity=learnable fails with the new error

- adjacency_threshold is 0.4 in every dataset config; WGCNA ignores it and uses
  adjacency_target_connectivity, so the stale per-dataset WGCNA cutoffs and their
  headers are removed and wgcna_binarization is stated explicitly
- STRING alias, bulk and interaction caches are locked per artifact, written
  atomically, and truncated downloads or corrupt JSON are rebuilt
- The pre-transform cache is built under a directory lock and saved atomically
- gene_identity rejects SAGN, which never sees runtime node features
- The config consistency test requires the same adjacency_threshold everywhere

Co-authored-by: Cursor <cursoragent@cursor.com>
@cornelislouisa

Copy link
Copy Markdown
Collaborator Author

The whole stack (#141 → #145) passed the reproducibility check against guille/kfold_relaunch. Full results are in #145 (comment) (the comment on #145). In brief: the pipeline code is identical to relaunch, the data caches are byte-identical, the sklearn baselines match exactly, an MLP best trial reproduces October bit for bit, and graph models differ only by CUDA nondeterminism.

@cornelislouisa
cornelislouisa marked this pull request as ready for review October 27, 2026 15:00
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.

2 participants