Remove redundant per-variant normalization in CV notebooks#233
Merged
Conversation
Since PR #230, functional_score_loss is already a per-variant .mean(), so total_loss_{training,validation} on ModelCollection.fit_models are already per-variant averages. Both CV notebooks were dividing by sample count again, producing doubly-normalized values that no longer matched the "mean Huber loss per variant" axis label. - Drop the n_samples dict and the `loss / n_samples` division in both experiments/simulation/notebooks/cross_validation.ipynb and experiments/scv2-spike/notebooks/cross_validation.ipynb - Keep mean_loss as an alias for loss in the emitted CSVs so downstream readers (manuscript_figures.ipynb) pick up the fix without schema changes - Delete experiments/scv2-spike/config/config_mean_loss.yaml (its grid was already absorbed into the default config.yaml) and drop the corresponding profile branch from the spike Snakefile - Update CLAUDE.md to warn that total_loss_* columns are per-variant Closes #231 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
total_loss_{training,validation}by a sample-count dict, but PR Normalize functional score loss per variant within each condition #230 already madefunctional_score_lossa per-variant.mean()— so the division was doubly-normalizing, silently diverging from the "mean Huber loss per variant" axis label.n_samplesconstruction and the division inexperiments/simulation/notebooks/cross_validation.ipynbandexperiments/scv2-spike/notebooks/cross_validation.ipynb; aliasmean_loss = lossso the CSV schema (andmanuscript_figures.ipynb, which readsmean_loss) is preserved.experiments/scv2-spike/config/config_mean_loss.yamland its Snakefile profile branch — the defaultconfig.yamlalready absorbed the V0.4.0-anchored grid, so the profile was a duplicate.total_loss_*columns are per-variant averages.Validation
Ran the
testprofile of both pipelines locally:mean_loss == lossrow-wise, loss values 4.93–6.09 (per-variant Huber scale, not sum-scale).mean_loss == lossrow-wise, loss values 2.53–3.39 (per-variant scale).n_samplescolumn.pixi run lint,pixi run fmt-check, and the fullpixi run testsuite (182 passed) are clean on this branch.Test plan
pixi run sim-testcompletes, CV CSV hasmean_loss == losspixi run spike-testcompletes, CV CSV hasmean_loss == losspixi run lintpixi run fmt-checkpixi run testCloses #231
🤖 Generated with Claude Code