Declare cell_type, and split by batch when is_train is missing - #28
Merged
Conversation
8 tasks
obs['is_train'] carries the NeurIPS 2021 competition split, so it is declared optional -- but process_dataset used it without checking, and a dataset without it produced four empty h5ads and exit 0. Fall back to holding out a quarter of the batches, or a quarter of the cells if there is only one batch. obs['cell_type'] is declared required, since the test subsample is weighted by it.
rcannood
force-pushed
the
fix/declare-is-train-cell-type
branch
from
July 29, 2026 13:19
e049307 to
4e57a79
Compare
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.
Describe your changes
process_datasetreads twoobscolumns that the API never declares:process_datasets/main.nfvalidates its inputs againstfile_common_dataset_mod{1,2}.yamland drops anything that fails -- so a dataset that honours the published contract but happens to lackis_trainsails through QC. In R,which(NULL == "train")isinteger(0), so both index sets come back empty and we write four zero-row objects without complaining.Reproduced on
bmmc_citewithobs["is_train"]removed:is_train is optional
I originally declared it required, but that's wrong:
obs["is_train"]is the NeurIPS 2021 competition's own split, and there's no reason another dataset would carry it. Declared optional, with a fallback that holds out a quarter of the batches -- keeping the spirit of the competition split, where test cells come from donors the method hasn't seen -- or a quarter of the cells when there's only one batch. It's seeded off--seed, so it's reproducible.All three paths, on bmmc_cite:
(the two fallbacks landing on 148 is a coincidence of
floor(594/4); they select different cells, and no path leaks a cell between train and test.)cell_type is required
Declared and enforced up front, so a missing annotation fails immediately rather than a few hundred lines later inside the subsampling branch.
Also added a line logging the split sizes -- "how many cells ended up on each side" was previously invisible in the logs.
Part of a series of PRs coming out of a pre-run review of the benchmark.
Checklist before requesting a review
I have performed a self-review of my code
Check the correct box. Does this PR contain:
Proposed changes are described in the CHANGELOG.md
CI Tests succeed and look good!