Files
hypertower/v4/figures/F4_bilateral.py
T
rpotter6298 3d7777f010 Add new experiments and analysis scripts for dropzero features
- Introduced `fused_importance_with_axial.py` to evaluate the importance of Axial_Length in the fused-head model.
- Created JSON configurations for various experiments excluding zero-importance clinical features:
  - `cd_solo_bilateral_dropzero.json`: Bilateral clinical-only evaluation.
  - `cd_solo_single_dropzero.json`: Single-eye clinical-only evaluation.
  - `ensemble_refugelike_ckpt_dropzero.json`: Ensemble model with dropped zero-importance features.
  - `ensemble_single_refugelike_dropzero.json`: Single-eye ensemble model with dropped features.
2026-08-24 12:26:16 +02:00

66 lines
2.1 KiB
Python

"""F4 (main text) - Bilateral clinical, image, and Hadamard L2 fusion.
Patient-level analogue of F3: same two-row / three-column layout, same pruned
clinical panel, but every column is the bilateral (both-eyes) model reading
from the patient-level 'hb' stage. All three columns share the pruned clinical
panel: astigmatism, dioptre_1, dioptre_2, and Phakic/Pseudophakic dropped
(see S8e). The image column has no clinical inputs so is unaffected by the
prune.
Columns (left -> right):
Clinical only (bilateral) (cd_solo_bilateral_dropzero, hb)
Image only (bilateral) (img_solo_bilateral_refugelike, hb)
Hadamard L2 fusion (bilateral) (ensemble_refugelike_ckpt_dropzero, hb)
Rows:
top: confidence strip - predicted P(Glaucoma) coloured by VF-MD tier
(severe / moderate / early) with normals in grey. Patients are the
unit of prediction here (~1 prediction per patient per fold-rep).
bottom: ROC per severity tier, each tier vs all normals; pooled ROC curve
with a 95% CI band from patient-level bootstrap; pooled AUC with
95% CI annotated.
Glaucoma - VF_MD not recorded is dropped from both rows (n = 0 patients at
the patient-worst-eye level).
Re-run:
python -m v4.figures.F4_bilateral
"""
from __future__ import annotations
import warnings
warnings.filterwarnings("ignore")
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
from v4.figures.util.loaders import RESULTS_ROOT
from v4.figures import F3_hadamard_focus as F3
OUT = Path(__file__).parent / "output" / "F4_bilateral.png"
SOURCES = [
("Clinical only (bilateral)",
RESULTS_ROOT / "explainability" / "cd_solo_bilateral_dropzero",
"hb"),
("Image only (bilateral)",
RESULTS_ROOT / "refuge_v2m_baseline" / "img_solo_bilateral_refugelike",
"hb"),
("Hadamard L2 fusion (bilateral)",
RESULTS_ROOT / "explainability" / "ensemble_refugelike_ckpt_dropzero",
"hb"),
]
def render() -> None:
"""Reuse every drawing primitive from F3; only source paths and out-file differ."""
F3.SOURCES = SOURCES
F3.OUT = OUT
F3.render()
if __name__ == "__main__":
render()