# Context Loader Test Report **Generated:** 2026-04-30T08:22:18.941Z **Source folder:** `D:\Projects\phd\PSEG\pges_toolkit\docs` ## Summary | Metric | Value | |---|---| | Files loaded | 3 | | Total text chars | 1,00,609 | | Estimated tokens | ~25,153 | | Budget used | 62.9% | | Truncated | true | | Images | 18 | ## Files (load order) 1. `DACTRL_Experiment_Summary.md` 2. `DACTRL_Summary.md` 3. `DACTRL_Architecture_Methodology.md (partial)` ## Images | # | File | KB | Description | |---|---|---|---| | 1 | `auc_f1_k_curve.png` | 52 | auc f1 k curve | | 2 | `bootstrap_f1_auc.png` | 97 | bootstrap f1 auc | | 3 | `c12_waveform_translator.png` | 76 | c12 waveform translator | | 4 | `c13_hightrials.png` | 132 | c13 hightrials | | 5 | `c13_three_source.png` | 82 | c13 three source | | 6 | `c14_honest_k0.png` | 88 | c14 honest k0 | | 7 | `cross_nucleus_clean.png` | 78 | cross nucleus clean | | 8 | `cross_nucleus_heatmap.png` | 140 | cross nucleus heatmap | | 9 | `cross_region_bar.png` | 48 | cross region bar | | 10 | `da_baselines.png` | 31 | da baselines | | 11 | `day0_comparison.png` | 84 | day0 comparison | | 12 | `embedding_tsne.png` | 319 | embedding tsne | | 13 | `feature_distributions.png` | 444 | feature distributions | | 14 | `feature_importance.png` | 73 | feature importance | | 15 | `latency_boxplot.png` | 77 | latency boxplot | | 16 | `learning_curve.png` | 60 | learning curve | | 17 | `reliability_diagram.png` | 115 | reliability diagram | | 18 | `seizure_lifecycle.png` | 164 | seizure lifecycle | ## Context Preview (first 3000 chars) ``` ──────────────────────────────────────────────────────────── ## SOURCE FILE: DACTRL_Experiment_Summary.md ──────────────────────────────────────────────────────────── # DACTRL — Complete Experiment Summary **Author:** Bhargava Ganti **Date:** April 2026 **Purpose:** Chronological record of every experiment tried, every combination tested, and what we learned from each. --- ## The Core Problem **Goal:** Detect Post-Ictal Generalized EEG Suppression (PGES) from thalamic DBS implant recordings (15 patients, ~100 windows each). **Two fundamental challenges:** 1. **Data scarcity** — 15 thalamic patients is not enough to train a deep learning model from scratch 2. **Domain gap** — large public EEG datasets are scalp-only; thalamic iEEG has different morphology, amplitude, and spectral properties **Solution hypothesis:** Use large scalp EEG corpora (CHB-MIT: 686 patients, TUH: 29 patients) to pre-train a feature encoder, then adapt to each thalamic patient with a few labeled examples (K-shot ProtoNet). --- ## Data Sources | Dataset | Type | Size | Notes | |---|---|---|---| | CHB-MIT | Scalp EEG | 686 patients | Post-ictal labels inferred (noisy) | | TUH EEG Corpus | Scalp EEG | 29 patients | Annotator-scored post-ictal (cleaner) | | PSEG Thalamic | Thalamic SEEG | 15 patients | FBTCS-only, 4 nuclei (CeM, CL, ANT, MD) | **Simultaneous recordings available with adequate scalp coverage (≥18ch):** P2 (CL, 19ch), P10 (ANT, 18ch), P12 (ANT, 19ch) *(P6: 2ch scalp — insufficient; P13: excluded from all analyses due to label noise)* --- ## Phase 1 — Biological Validation (Jan–Feb 2026) ### What we did Validated whether published PGES criteria apply to thalamic recordings. Extracted 11 features from raw EDF files for 15 patients and compared PGES vs baseline distributions. ### What we found — Critical discovery **Three features are directionally INVERTED in thalamus vs scalp:** | Feature | Scalp PGES | Thalamic PGES | Why | |---|---|---|---| | Suppression Ratio (SR) | HIGH (cortex suppressed) | LOW (thalamus active, driving delta) | Perspective inversion | | Approx Entropy (ApEn) | LOW (flat signal) | LOW | Same direction (ok) | | Zero-Crossing Rate (ZCR) | LOW | LOW | Same direction (ok) | Actually: SR is the key inversion — scalp PGES means flat line (low amplitude → high SR paradoxically via the suppression formula), thalamic PGES means active slow delta (high amplitude → low SR). **Impact:** Before correction, biological rule had 86.8% false positive rate. After correction: 29.4%. **Script:** `verify_biological_rule.py` --- ## Phase 2 — Algorithm Development (Feb–Mar 2026) ### Iteration 1 — v1 FOMAML (Baseline) **What:** FOMAML (first-order MAML) meta-learning with scalp pre-training (Stage 1) + thalamic LOSO meta-training (Stage 2). **Result:** F1=0.765±0.182 (15-patient LOSO, K=10) **Script:** Original DACTRL pipeline --- ### Iteration 2 — Training Source Comparison (6 Scenarios) Testing what data combination drives perf ```