Repository navigation
Run sklearn baselines on the GNN features and folds with one global configuration - #143
Open
cornelislouisa wants to merge 1 commit into
Open
cornelislouisa wants to merge 1 commit into
cornelislouisa wants to merge 1 commit into
Conversation
…onfiguration - Standard baselines rebuild the GNN input from the Hub data: the same split and fold (including grouped folds), train-only corrections and imputation, and the same node selection, with seeded random selection - K-fold runs score every grid configuration on all validation folds, keep the best mean, cache that choice, and refit each fold on its training split - Remove SelectKBest from the dataset baseline grids; features are the GNN node selection - Baselines log to logger.wandb.entity, now an explicit optional setting - run_baselines.sh covers all six datasets, five folds and ratios down to 0.3, reads its axes from the environment and passes extra Hydra overrides - verify_baseline_features.py checks the baseline features against every cached GNN fold and fails when it finds none Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Oct 27, 2026
cornelislouisa
marked this pull request as ready for review
October 27, 2026 15:01
johmathe
approved these changes
Oct 28, 2026
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.
Third of five stacked PRs bringing the k-fold work from
guille/kfold_relaunch(the code behind the October k-fold results) intomain. Targets #142. Draft until the whole stack passes a reproducibility check againstkfold_relaunch. Supersedes #137.Why
The baselines should answer one question: how much does the graph add over a classifier on the same input? On
mainthey did not see the same input or the same protocol as the GNNs:SelectKBeston the full matrix instead of the GNN node selection, andmethod=randomcould pick different genes from the GNN cache.Changes
ogbench/baseline.py(fromkfold_relaunch)load_and_prepare_data(standard baselinessvm,elastic_net) rebuilds the GNN input from the pinned Hub revision: the same split and fold viacompute_omics_split_indicesandresolve_split_groups(so grouped datasets get grouped folds), the same train-only corrections (covariate adjustment, ComBat, promoter probe pick, median centering), imputation, and the same node selection.method=randomusesselection_seed, so it picks exactly the GNN cache's genes. No graph is built.load_and_prepare_data_gnn_features(svm_gnn_features,elastic_net_gnn_features) reads the GNN cache (selected_data.parquet,split_info.json).split_type=k-fold, every grid configuration is scored on the validation fold of allkfolds and the best mean is kept (baseline_hparam_selection: global_kfold_mean_validation; any other value raises). The choice is cached as JSON underbaseline_hparam_cache_dirwith a file lock, so the other folds reuse it. Each fold is then refit on its training split and evaluated on its test fold. Fixed splits score the grid on their single train/validation cut.cfg.logger.wandb.entity, the same setting GNN runs use.Configs
configs/baseline.yaml:baseline_hparam_selectionandbaseline_hparam_cache_dir.configs/logger/wandb.yaml:entity: null # optional W&B team or organizationreplaces the commented-out key. Withnull, W&B logs to the user's own account as before.configs/dataset/*.yaml: removeSelectKBestandfeature_selection__kfrom the baseline grids, since the features are now the GNN node selection.Scripts
run_baselines.shruns the standard baselines over all six datasets, folds 0 to 4, ratios 1.0/0.8/0.5/0.3 and all four selection methods.DATASETS,FOLDS,NODE_RATIOS,METHODSandPYTHONcan narrow it from the environment, and extra arguments pass through as Hydra overrides.scripts/verify_baseline_features.pychecks that the standard baselines select exactly the features stored in every cached GNN fold. Two fixes overkfold_relaunch: its path pattern matches the cache layout from Make leak-free 5-fold cross-validation the default for omics datasets #142 (hf_<revision>/.../impute_<method>/), which it previously did not match at all, and it now exits with an error when it finds no cached folds instead of reporting0/0as success.Docs
gnn_features, and therun_baselines.shenvironment variables.Differences from #137
#137 introduced global selection; this PR is the later version from
kfold_relaunch:resolve_split_groups, so Parkinson's (and tuberculosis in the next PR) baselines use the same grouped folds as the GNNsrandomselection shared with the GNN cacheper_foldmode is removed; k-fold always uses global selection, fixed splits use their single validation cutrun_baselines.shTests
test_baseline_global_hparams.py(selection, caching, rejection of other modes),test_no_preprocessing_leakage.py(corrections, imputation and selection only see training samples),test_composed_config_parity.py(GNN and baseline configs compose to the same data settings).Checks
pytest -m "not slow": 272 passed; pre-commit cleanDATASETS=motrpac FOLDS=0,1 NODE_RATIOS=0.5 METHODS=random bash run_baselines.sh: the global selection is computed once and reused by the second foldmethod=random, thegnn_featuresbaselines run, andverify_baseline_features.pyreports 5/5 folds identical to the GNN cachegnn_featuresfails with a clear "run the GNN pipeline first" error