Skip to content

Add cell-phenotype MoA (channel-dropout multiplex) competition pipeline - #1

Open
aurascoper wants to merge 3 commits into
mainfrom
cpm-cell-phenotype-pipeline
Open

Add cell-phenotype MoA (channel-dropout multiplex) competition pipeline#1
aurascoper wants to merge 3 commits into
mainfrom
cpm-cell-phenotype-pipeline

Conversation

@aurascoper

Copy link
Copy Markdown
Owner

What

A from-scratch pipeline for the 12-class mechanism-of-action (MoA) classification competition (Cell-Painting panels, public.zip), mirroring the Eris A10G + offline Kaggle-kernel harness pattern. Adds a self-contained src/ package; leaves existing RNA files untouched.

Why it's shaped this way — measured, not assumed

Every design decision is grounded in facts verified across all 432 images (see approach.md):

Measured Consequence
Exactly one panel pre-zeroed (0,0,0) per image, train ≡ test distribution Panel dropout is OFF (a 2nd mask is off-distribution); aug is slot-preserving within-panel only
Single-compound "thin" classes = moa_02/05/09 → indices [2,5,9] config.verify_against_data() re-checks the mapping against the CSV so it can't silently desync (the earlier blueprint's off-by-one)
Panels are single-marker (RGB corr ≥0.998) Channel-agnostic path reduces each surviving panel to one channel (C=2)

Corrected vs. the earlier blueprint

  • Sign-independent probability-space thin-shrink + renormalize (not logits/=T, which raised thin prob on non-thin images)
  • BALD mutual-information ensemble disagreement (not entropy-of-mean)
  • Compound-grouped CV pins thin compounds into every train fold (no thin OOF by design); thin_shrink calibrated by LOCO on the 2-compound classes as a lower bound

Backbone

Frozen ImageNet convnext_tiny probe as the disqualification-proof default (OOF dense logloss 1.463 vs uniform 2.485). OpenPhenom-S/16 (CA-MAE, channel-agnostic — verified against arXiv:2404.10242) wired as a license-gated drop-in behind CPM_LICENSE_OK, pending a read of the competition's weight-license clauses.

Verification

  • 5/5 data-contract tests pass (tests/test_cpm_pipeline.py): mask one-hot matches actual black pixels, aug is slot-preserving, CV coverage dense=216/216, thin=0/72
  • End-to-end dry run produces a valid submission.csv (144 rows, 12 cols, sums to 1)
  • Offline backbone load verified; Kaggle infer/train notebooks + metadata (internet-off infer) + upload_kaggle_dataset.py included

Not included (by design / .gitignore)

Extracted data, backbone weights, trained heads, and regenerated calib_*.json/metrics_*.json — all reconstructable via setup_eris.shpreprocesstraincalibrate.

🤖 Generated with Claude Code

aurascoper and others added 3 commits June 30, 2026 23:15
From-scratch pipeline for the 12-class mechanism-of-action classification
competition (Cell-Painting panels, public.zip). Mirrors the Eris A10G +
offline Kaggle-kernel harness pattern.

Design grounded in measured data facts (all 432 images verified):
- exactly one panel pre-masked to (0,0,0) per image, train == test dist
  => panel dropout is OFF; slot-preserving within-panel aug only
- single-compound "thin" classes = moa_02/05/09 -> indices [2,5,9], with
  config.verify_against_data() re-checking the mapping against the CSV
- single-marker panels (RGB corr >=0.998) => channel-agnostic path can
  reduce each surviving panel to one channel

Corrected calibration/CV vs. the earlier blueprint:
- sign-independent probability-space thin-shrink (not logit division)
- BALD mutual-information ensemble disagreement (not entropy of mean)
- compound-grouped CV pins thin compounds into every train fold (no thin
  OOF); thin_shrink calibrated by LOCO on 2-compound classes as a lower bound

Backbone: frozen ImageNet convnext_tiny probe (disqualification-proof
default; OOF dense logloss 1.463 vs uniform 2.485). OpenPhenom-S/16 (CA-MAE)
wired as a license-gated drop-in behind CPM_LICENSE_OK.

Includes: src/{config,preprocess,dataset,cv,models,losses,train,calibrate,
infer}.py, data-contract tests, offline/train Kaggle notebooks + metadata,
upload_kaggle_dataset.py, setup_eris.sh, approach.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…docs

Correct the submission harness: Eris/Shipd runs a self-contained solution.ipynb
(reads ./dataset/public/, writes ./working/submission.csv, Kaggle-Docker libs only,
<30 min on A10G) — NOT a Kaggle kernel. Remove the mis-analogized Kaggle scaffolding.

- solution.ipynb: torchvision convnext_small frozen probe + MLP head, compound-grouped
  CV (thin compounds pinned, no thin OOF), temperature + sign-correct thin-shrink +
  BALD blend, rubric-narrated markdown. Validated end-to-end via nbconvert on a staged
  ./dataset/public layout: dense-OOF logloss 1.366 vs uniform 2.485 (macro-F1 0.495),
  valid 144-row submission, ~80s on CPU. Defensive weight load (pretrained -> fallback).
- src/models.py: add imagenet_convnext_small/base to the registry (small won the
  compound-blind OOF sweep: 1.316 timm / 1.366 torchvision, vs tiny 1.463, base 1.344).
- Remove notebooks/kaggle_*.ipynb, kernel-metadata-*.json, upload_kaggle_dataset.py.
- Fix .gitignore (inline comments are not valid gitignore syntax -> data/weights were
  not actually being ignored).
- Rewrite README.md + CLAUDE.md for the CPM task (were stale RNA docs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iew/craft-review)

Replace the markdown approach doc with flowing prose: plain-text section labels
(no # headers), no bold/asterisks, no backticks, no em/en dashes, no AI-style
headers. Passes the prose-craft pcr pre-screener with zero hard fails; prose-review
advisories (contrastive-clarification tic, back-half block uniformity, declarative
dominance, conclusion symmetry) applied; craft dimensions (named concepts, central-
point dwelling on compound confounding, aphoristic close) satisfied.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant