Archive 4 checkpoints (1-4)
Browse files- .gitattributes +2 -0
- paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pdf +3 -0
- paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pptx +3 -0
- paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/README.md +59 -0
- paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/tools/sec03_panel.py +197 -0
.gitattributes
CHANGED
|
@@ -63,3 +63,5 @@ paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-fina
|
|
| 63 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pdf filter=lfs diff=lfs merge=lfs -text
|
| 64 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pptx filter=lfs diff=lfs merge=lfs -text
|
| 65 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/sec01_slide_a.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 63 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pdf filter=lfs diff=lfs merge=lfs -text
|
| 64 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pptx filter=lfs diff=lfs merge=lfs -text
|
| 65 |
paper-releases/pbisc-diffusion/updates/20260930T065633Z-summary-deck-scsemi-final/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/figures/sec01_slide_a.pdf filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pdf filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pptx filter=lfs diff=lfs merge=lfs -text
|
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea779ae9af4771ce0a5b1d96d59ecf06c04cb59892eb8c404af821317c20850d
|
| 3 |
+
size 4547408
|
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/PBISC-Diffusion_paper_summary_20260930.pptx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:47a36cef0470ced87a47e41b57674d8b2d02f8fe7761f7759246054794d7a817
|
| 3 |
+
size 5100576
|
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PBISC-Diffusion paper summary deck (2026-09-30, r00)
|
| 2 |
+
|
| 3 |
+
28-slide English summary of the PBISC-Diffusion (Model 8) paper experiments: title,
|
| 4 |
+
outline, 10 sections (23 content slides), then a Backup divider and 3 backup slides.
|
| 5 |
+
Short keyword lines only; the figures carry the results. Section 10 is planned work.
|
| 6 |
+
|
| 7 |
+
- `PBISC-Diffusion_paper_summary_20260930.pptx`: the deck
|
| 8 |
+
- `PBISC-Diffusion_paper_summary_20260930.pdf`: LibreOffice PDF of the deck
|
| 9 |
+
- `data/slides_spec.json`: slide order, titles, keywords, footnotes, speaker-note text
|
| 10 |
+
- `generate_deck.py`: builds the pptx from `data/slides_spec.json` only (python-pptx)
|
| 11 |
+
- `figures/`: all slide figures (PNG + PDF), made by `tools/sec*.py`
|
| 12 |
+
- `data/sec*.csv`, `data/sec09_slide_text.json`: every plotted or quoted number with its source path
|
| 13 |
+
- `render/`: PDF and 70-dpi slide JPGs for checking
|
| 14 |
+
|
| 15 |
+
## Rebuild
|
| 16 |
+
|
| 17 |
+
Everything is CPU only; no GPU or checkpoint is touched.
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
cd /home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/2026-09-30--paper-summary--r00
|
| 21 |
+
# figures + data tables (sec03_common.py and style.py are shared helpers, not run directly)
|
| 22 |
+
for f in sec01_overview sec02_backbone sec03_width_loss sec03_width_bench sec03_panel \
|
| 23 |
+
sec04_sle_benchmark sec05_condition_space sec05_cells_offmanifold \
|
| 24 |
+
sec05_behcet_direction sec05_shift_cohorts sec06_finetune_method sec07_ft_modes \
|
| 25 |
+
sec07_k_aug sec08_pairs_needed sec09_paired_validation sec10_paired_subset_cohorts; do
|
| 26 |
+
python3 "tools/$f.py" || break
|
| 27 |
+
done
|
| 28 |
+
python3 tools/sync_sec09_text.py # copy regenerated section 9 text into data/slides_spec.json
|
| 29 |
+
python3 generate_deck.py # -> PBISC-Diffusion_paper_summary_20260930.pptx
|
| 30 |
+
soffice --headless --convert-to pdf --outdir render PBISC-Diffusion_paper_summary_20260930.pptx
|
| 31 |
+
pdftoppm -jpeg -r 70 render/PBISC-Diffusion_paper_summary_20260930.pdf render/slide
|
| 32 |
+
cp render/PBISC-Diffusion_paper_summary_20260930.pdf .
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
`generate_deck.py` stops with an error if a figure is missing, a title does not fit on one
|
| 36 |
+
line, a footnote needs more than 2 lines, or any text contains Korean or placeholder words.
|
| 37 |
+
|
| 38 |
+
## Notes
|
| 39 |
+
|
| 40 |
+
- Section 9 (few-pair scSemiProfiler comparison) uses all 25 scSemiProfiler draws
|
| 41 |
+
(5 cohorts x 5 draws). If scores change, rerun `tools/sec09_paired_validation.py`, then
|
| 42 |
+
`tools/sync_sec09_text.py`, then check the short footnotes it lists and rebuild.
|
| 43 |
+
- On-slide footnotes are one short line; the full source and method text is in the speaker
|
| 44 |
+
notes (`footnote_full` in the spec).
|
| 45 |
+
- `DRAFT_1150_*`: frozen copy shown at the 2026-09-30 12:00 meeting (23/25 scSemiProfiler
|
| 46 |
+
draws, long footnotes). Superseded by the files above.
|
| 47 |
+
- Story rule (user decision 2026-09-30): the deck and paper do not mention PBISC-VAE, reference
|
| 48 |
+
calibration (refcal), the TPM input variant or any calibration arm. The no-fine-tune baseline is
|
| 49 |
+
zero-shot on real bulk as measured; the sc-only control is the sc-only fine-tune fed raw bulk.
|
| 50 |
+
`tools/sec04_immicro.py` (refcal vs scSemiProfiler on ImMicro) is kept but no longer in the deck.
|
| 51 |
+
The pre-revision deck, scripts and figures are in `_archive/2026-09-30_before_no_vae_refcal/`.
|
| 52 |
+
|
| 53 |
+
## Sources
|
| 54 |
+
|
| 55 |
+
Final model: `runs/f01_6k_1x_seed20260627` (epoch 16, EMA). Scores and receipts come from
|
| 56 |
+
`plans/utility_studies_final6k_20260925/`, `plans/paired_finetune_intradataset_20260927/`,
|
| 57 |
+
`plans/immicro_scsemi_comparison_20260927/`, `plans/floor01_campaign_20260923/`,
|
| 58 |
+
`analysis/scsemi_benchmark_diffusion_20260913/` and the run folders named in each
|
| 59 |
+
`data/sec*.csv`. Manuscript: `/home/sj_server_1/PBISC/paper-release-20260928/manuscript/`.
|
paper-releases/pbisc-diffusion/updates/20260930T090852Z-summary-deck-final-path-story/diffusion/dataset/server_1/model8/presentations/2026-09-30--paper-summary--r00/tools/sec03_panel.py
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Section 3c: gene-context (panel) ablation on the 0.1% detection-floor panels, 1x architecture.
|
| 3 |
+
|
| 4 |
+
Benchmark: part 16 of each panel, Bernoulli (drawn) read-out, scANVI metrics on the 1,006 benchmark genes
|
| 5 |
+
present in every panel (the 2,980-gene benchmark panel intersected with the 2k tier;
|
| 6 |
+
evaluation_manifest_common.json), with scSemiProfiler on the same axis.
|
| 7 |
+
Scores come from the utility-study re-run of the same 1,006-gene pipeline (metrics_1006/summary_tidy.csv),
|
| 8 |
+
which adds 4 extra sampling seeds of the final 6k checkpoint and reproduces every floor01 row exactly
|
| 9 |
+
(asserted here against analysis/floor01_benchmark_20260923/metrics/summary_tidy.csv).
|
| 10 |
+
6k is drawn as the 5-seed mean +- SD with the seeds as dots; the base seed used by the floor01 ranking is
|
| 11 |
+
the best of the five. 2k, 3k and 15k have one seed each.
|
| 12 |
+
Loss: validation loss divided by the panel's own part-16 value. Absolute losses are not compared
|
| 13 |
+
across panels because each panel predicts a different gene set.
|
| 14 |
+
|
| 15 |
+
Writes figures/sec03_panel.{png,pdf}, data/sec03_panel_bench.csv, data/sec03_panel_seeds.csv,
|
| 16 |
+
data/sec03_panel_loss.csv, data/sec03_panel_headline.csv.
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import json
|
| 21 |
+
import re
|
| 22 |
+
import sys
|
| 23 |
+
|
| 24 |
+
sys.path.insert(0, "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/presentations/"
|
| 25 |
+
"2026-09-30--paper-summary--r00/tools")
|
| 26 |
+
import matplotlib.pyplot as plt
|
| 27 |
+
import numpy as np
|
| 28 |
+
import pandas as pd
|
| 29 |
+
from matplotlib.lines import Line2D
|
| 30 |
+
from matplotlib.patches import Patch
|
| 31 |
+
|
| 32 |
+
import style
|
| 33 |
+
from sec03_common import (DATA, FIG, M8, PANEL_RUNS, PANEL_SCORES, PANEL_SCORES_MD, PANEL_SEED_MANIFEST,
|
| 34 |
+
PANEL_SEED_SCORES, SAT_TOL, fmt_params, n_donors, read_run, saturation_epoch)
|
| 35 |
+
|
| 36 |
+
COMMON = M8 / "plans/floor01_campaign_20260923/evaluation_manifest_common.json"
|
| 37 |
+
FINAL_CKPT = M8 / "runs/f01_6k_1x_seed20260627/checkpoint_epoch_016.pt"
|
| 38 |
+
METHOD = {"2k": "diffusion_f012k_e16", "3k": "diffusion_f013k_e16", "6k": "diffusion_f016k_e16",
|
| 39 |
+
"15k": "diffusion_f01p15k_e16"}
|
| 40 |
+
SEED_METHODS = ["diffusion_f016k_e16"] + [f"diffusion_f016ks{i}_e16" for i in range(1, 5)] # base seed first
|
| 41 |
+
METRICS = [("logfc_r", "mean_logFC_pearson", "logFC r (higher better)"),
|
| 42 |
+
("top50", "total_top50_overlap", "Top-50 DEG overlap (higher better)"),
|
| 43 |
+
("comp_l1", "composition_l1", "Composition L1 (lower better)")]
|
| 44 |
+
REFS = ("scSemiProfiler",)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def load_scores(path) -> pd.DataFrame:
|
| 48 |
+
t = pd.read_csv(path)
|
| 49 |
+
t = t[t["celltype_gate"] == "common_celltype_gate"]
|
| 50 |
+
# each comparison block carries the reference rows once; they are identical across blocks
|
| 51 |
+
for b in REFS:
|
| 52 |
+
rb = t[t["method"] == b]
|
| 53 |
+
assert rb[[c for _, c, _ in METRICS]].nunique().max() == 1, b
|
| 54 |
+
return t.drop_duplicates("method").set_index("method")
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def main() -> int:
|
| 58 |
+
n_common = len(json.loads(COMMON.read_text())["evaluation_gene_ids"])
|
| 59 |
+
donors = n_donors(PANEL_SCORES_MD)
|
| 60 |
+
t = load_scores(PANEL_SEED_SCORES)
|
| 61 |
+
assert set(t["panel_genes"]) == {n_common}, (set(t["panel_genes"]), n_common)
|
| 62 |
+
# the seed re-run must reproduce the floor01 scoring call row for row
|
| 63 |
+
f01 = load_scores(PANEL_SCORES)
|
| 64 |
+
for m in list(METHOD.values()) + list(REFS):
|
| 65 |
+
for _, c, _ in METRICS:
|
| 66 |
+
assert abs(float(t.loc[m, c]) - float(f01.loc[m, c])) < 1e-9, (m, c)
|
| 67 |
+
# all five 6k seeds come from the one final checkpoint
|
| 68 |
+
ck = json.loads(PANEL_SEED_MANIFEST.read_text())["files"]["checkpoint"]
|
| 69 |
+
assert len(ck) == 1 and ck[0]["path"] == str(FINAL_CKPT), ck
|
| 70 |
+
ckpt_sha = ck[0]["sha256"]
|
| 71 |
+
|
| 72 |
+
seeds = pd.DataFrame([{"method": m, "seed_rank_in_list": i, "is_base_seed": i == 0,
|
| 73 |
+
**{k: float(t.loc[m, c]) for k, c, _ in METRICS}} for i, m in enumerate(SEED_METHODS)])
|
| 74 |
+
seeds["checkpoint"], seeds["checkpoint_sha256"] = str(FINAL_CKPT), ckpt_sha
|
| 75 |
+
seeds["source"] = str(PANEL_SEED_SCORES)
|
| 76 |
+
seeds.to_csv(DATA / "sec03_panel_seeds.csv", index=False)
|
| 77 |
+
s_mean = {k: seeds[k].mean() for k, _, _ in METRICS}
|
| 78 |
+
s_sd = {k: seeds[k].std(ddof=1) for k, _, _ in METRICS}
|
| 79 |
+
|
| 80 |
+
runs, loss_rows, bench_rows = {}, [], []
|
| 81 |
+
for key, name, host in PANEL_RUNS:
|
| 82 |
+
r = read_run(name, host)
|
| 83 |
+
runs[key] = r
|
| 84 |
+
h = r["hist"]
|
| 85 |
+
assert int(h["epoch"].max()) == 16
|
| 86 |
+
v16 = float(h["val_loss"].iloc[-1])
|
| 87 |
+
sat = saturation_epoch(h["val_loss"].tolist())
|
| 88 |
+
r["sat"], r["v16"] = sat, v16
|
| 89 |
+
for _, e in h.iterrows():
|
| 90 |
+
loss_rows.append({"panel": key, "run": name, "source": r["source"] + "/history.json",
|
| 91 |
+
"n_genes": r["cfg"]["data"]["n_genes"], "params": r["status"]["parameters"],
|
| 92 |
+
"epoch": int(e["epoch"]), "train_loss": e["train_loss"], "val_loss": e["val_loss"],
|
| 93 |
+
"val_rel_e16": e["val_loss"] / v16, "sat_epoch": sat,
|
| 94 |
+
"sat_rule": f"val within {SAT_TOL:.0%} of part-16 value"})
|
| 95 |
+
row = {"arm": key, "method": METHOD[key], "n_genes": r["cfg"]["data"]["n_genes"],
|
| 96 |
+
"params": r["status"]["parameters"], "val_loss_e16": v16}
|
| 97 |
+
if key == "6k":
|
| 98 |
+
row.update({"n_seeds": len(seeds), **{k: s_mean[k] for k in s_mean},
|
| 99 |
+
**{f"{k}_sd": s_sd[k] for k in s_sd},
|
| 100 |
+
**{f"{k}_base_seed": float(t.loc[METHOD[key], c]) for k, c, _ in METRICS}})
|
| 101 |
+
else:
|
| 102 |
+
row.update({"n_seeds": 1, **{k: float(t.loc[METHOD[key], c]) for k, c, _ in METRICS}})
|
| 103 |
+
bench_rows.append(row)
|
| 104 |
+
for b in REFS:
|
| 105 |
+
bench_rows.append({"arm": b, "method": b, **{k: float(t.loc[b, c]) for k, c, _ in METRICS}})
|
| 106 |
+
bench = pd.DataFrame(bench_rows)
|
| 107 |
+
bench["eval_genes"], bench["n_donors"], bench["part"] = n_common, donors, 16
|
| 108 |
+
bench["readout"] = "Bernoulli (drawn)"
|
| 109 |
+
bench["source"] = str(PANEL_SEED_SCORES)
|
| 110 |
+
bench.to_csv(DATA / "sec03_panel_bench.csv", index=False)
|
| 111 |
+
loss = pd.DataFrame(loss_rows)
|
| 112 |
+
assert loss["params"].notna().all()
|
| 113 |
+
loss.to_csv(DATA / "sec03_panel_loss.csv", index=False)
|
| 114 |
+
B = bench.set_index("arm")
|
| 115 |
+
|
| 116 |
+
# headline checks for the keyword lines
|
| 117 |
+
lo = {k: seeds[k].min() for k, _, _ in METRICS}
|
| 118 |
+
hi = {k: seeds[k].max() for k, _, _ in METRICS}
|
| 119 |
+
in_range_3k = {k: bool(lo[k] - 1e-12 <= B.loc["3k", k] <= hi[k] + 1e-12) for k, _, _ in METRICS}
|
| 120 |
+
base_rank = {k: int((seeds[k] > seeds.loc[0, k]).sum()) + 1 if k != "comp_l1"
|
| 121 |
+
else int((seeds[k] < seeds.loc[0, k]).sum()) + 1 for k, _, _ in METRICS}
|
| 122 |
+
m = re.search(r"\|\s*CLEC9A\s*\|\s*([^|]+?)\s*\|\s*([\d,]+)\s*\|\s*(\w+)\s*\|", PANEL_SCORES_MD.read_text())
|
| 123 |
+
assert m, "CLEC9A row missing"
|
| 124 |
+
head = pd.DataFrame([
|
| 125 |
+
{"quantity": "6k_seed_mean_r_top50_l1", "value": "/".join(f"{s_mean[k]:.3f}" for k in s_mean)},
|
| 126 |
+
{"quantity": "6k_seed_sd_r_top50_l1", "value": "/".join(f"{s_sd[k]:.3f}" for k in s_sd)},
|
| 127 |
+
{"quantity": "6k_seed_min_max_r", "value": f"{lo['logfc_r']:.3f}-{hi['logfc_r']:.3f}"},
|
| 128 |
+
{"quantity": "6k_seed_min_max_top50", "value": f"{lo['top50']:.0f}-{hi['top50']:.0f}"},
|
| 129 |
+
{"quantity": "6k_base_seed_rank_of_5_r_top50_l1", "value": "/".join(str(v) for v in base_rank.values())},
|
| 130 |
+
{"quantity": "3k_inside_6k_seed_range_r_top50_l1", "value": "/".join(str(v) for v in in_range_3k.values())},
|
| 131 |
+
{"quantity": "6k_mean_minus_3k_r", "value": s_mean["logfc_r"] - B.loc["3k", "logfc_r"]},
|
| 132 |
+
{"quantity": "6k_mean_minus_3k_top50", "value": s_mean["top50"] - B.loc["3k", "top50"]},
|
| 133 |
+
{"quantity": "best_comp_l1_panel", "value": B.loc[["2k", "3k", "6k", "15k"], "comp_l1"].idxmin()},
|
| 134 |
+
{"quantity": "worst_comp_l1_panel", "value": B.loc[["2k", "3k", "6k", "15k"], "comp_l1"].idxmax()},
|
| 135 |
+
{"quantity": "CLEC9A_population_rank_smallest_panel", "value": f"{m.group(1)}/{m.group(2)}/{m.group(3)}"},
|
| 136 |
+
{"quantity": "final_checkpoint_sha256", "value": ckpt_sha},
|
| 137 |
+
])
|
| 138 |
+
head["source"] = [str(PANEL_SEED_SCORES)] * 10 + [str(PANEL_SCORES_MD), str(PANEL_SEED_MANIFEST)]
|
| 139 |
+
head.to_csv(DATA / "sec03_panel_headline.csv", index=False)
|
| 140 |
+
|
| 141 |
+
# --- one full-width figure: three benchmark panels + relative validation loss ----------------
|
| 142 |
+
keys = [k for k, _, _ in PANEL_RUNS]
|
| 143 |
+
i6 = keys.index("6k")
|
| 144 |
+
fig, axes = plt.subplots(1, 4, figsize=style.FULL, gridspec_kw={"width_ratios": [1, 1, 1, 1.55]})
|
| 145 |
+
rng = np.random.default_rng(0)
|
| 146 |
+
for ax, (k, _, ylab) in zip(axes[:3], METRICS):
|
| 147 |
+
for i, key in enumerate(keys):
|
| 148 |
+
ax.bar(i, B.loc[key, k], width=0.72, color=style.PANEL[key], zorder=2)
|
| 149 |
+
# SD whisker left of centre, the five seeds right of centre, so neither hides the other
|
| 150 |
+
ax.errorbar(i6 - 0.14, s_mean[k], yerr=s_sd[k], color=style.INK, lw=1.4, capsize=4, capthick=1.4, zorder=4)
|
| 151 |
+
ax.scatter(i6 + 0.16 + rng.uniform(-0.06, 0.06, len(seeds)), seeds[k], s=22, color=style.INK, zorder=5,
|
| 152 |
+
edgecolors="white", linewidths=0.6)
|
| 153 |
+
ax.axhline(B.loc["scSemiProfiler", k], color=style.ARM["scsemi"], lw=1.8, ls="--", zorder=3)
|
| 154 |
+
ax.set_xticks(range(len(keys)))
|
| 155 |
+
ax.set_xticklabels(keys)
|
| 156 |
+
ax.get_xticklabels()[i6].set_fontweight("bold")
|
| 157 |
+
ax.set_xlim(-0.6, len(keys) - 0.4)
|
| 158 |
+
ax.set_xlabel("Gene panel")
|
| 159 |
+
ax.set_ylabel(ylab)
|
| 160 |
+
ax.set_ylim(0, max(B[k].max(), seeds[k].max()) * 1.12)
|
| 161 |
+
|
| 162 |
+
ax = axes[3]
|
| 163 |
+
for key in keys:
|
| 164 |
+
r = runs[key]
|
| 165 |
+
h = r["hist"]
|
| 166 |
+
rel = h["val_loss"] / r["v16"]
|
| 167 |
+
ax.plot(h["epoch"], rel, "-o", color=style.PANEL[key], ms=3.5, lw=1.8,
|
| 168 |
+
label=f"{key}, {fmt_params(int(r['status']['parameters']))}, sat. E{r['sat']}")
|
| 169 |
+
ax.plot([r["sat"]], [rel.iloc[r["sat"] - 1]], marker="o", ms=11, mfc="none", mec=style.INK, mew=1.3)
|
| 170 |
+
ax.axhline(1.0 + SAT_TOL, color=style.GREY, lw=0.9, ls=":")
|
| 171 |
+
ax.text(16.3, 1.0 + SAT_TOL + 0.002, f"+{SAT_TOL:.0%}", va="bottom", ha="right", fontsize=12,
|
| 172 |
+
color=style.GREY)
|
| 173 |
+
ax.set_xlabel("Schedule part (epoch)")
|
| 174 |
+
ax.set_ylabel("Val. loss / own part-16 value")
|
| 175 |
+
ax.set_xticks([1, 4, 8, 12, 16])
|
| 176 |
+
ax.set_xlim(0.5, 16.5)
|
| 177 |
+
ax.legend(loc="upper right", handlelength=1.4, borderaxespad=0.1)
|
| 178 |
+
|
| 179 |
+
handles = [Patch(facecolor=style.GREY, label="bars 2k, 3k, 15k: 1 seed"),
|
| 180 |
+
Line2D([], [], color=style.INK, lw=1.4, marker="o", ms=4, mec="white",
|
| 181 |
+
label=f"6k: {len(seeds)} seeds, mean ± SD"),
|
| 182 |
+
Line2D([], [], color=style.ARM["scsemi"], lw=1.8, ls="--", label="scSemiProfiler")]
|
| 183 |
+
fig.legend(handles=handles, loc="upper left", ncol=len(handles), bbox_to_anchor=(0.06, 1.07),
|
| 184 |
+
handlelength=2.0, columnspacing=2.4)
|
| 185 |
+
fig.tight_layout(w_pad=1.6)
|
| 186 |
+
style.save(fig, "sec03_panel", FIG)
|
| 187 |
+
|
| 188 |
+
print(f"common genes {n_common}, donors {donors}, checkpoint sha {ckpt_sha[:8]}")
|
| 189 |
+
print(bench.drop(columns=["source"]).round(4).to_string())
|
| 190 |
+
print(seeds[["method", "logfc_r", "top50", "comp_l1"]].round(4).to_string())
|
| 191 |
+
print(head[["quantity", "value"]].to_string())
|
| 192 |
+
print({k: runs[k]["sat"] for k in runs})
|
| 193 |
+
return 0
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
if __name__ == "__main__":
|
| 197 |
+
raise SystemExit(main())
|