# results_trial_mmd

Whole-trial unlabeled **energy/MMD** stream assignment: IRM↔SWA fuse `w=0.5` vs 4-seed `linear_hp30`.

**Distinct from** framewise `domain-emis-ll` (per-frame emission LL → `const_fuse`): here each **trial** gets one gate from closeness of that trial’s summary stats to each stream’s **train emission ball** (Mahalanobis / Euclid / energy / RBF-MMD).

Evidence: `g·fuse + (1−g)·hp30` with `g` constant across frames of the trial. No labels at test. HMM preset **0.994 / 0.8**.

Code: `trial_mmd_stream.py`. JSON: `results/research/trial_mmd_stream.json`. Log: `experiments/trial_mmd_stream.log` / `_console.log`. CPU on `models/causal_moe_fuse/cache/`.

## Method

1. Per-trial summary of each stream: `mom4` = (mean, std, |mean|, energy); `mom_q` = mom4 + quantiles of x and |x|.
2. Train-only ball per stream: mean/cov (+ cloud for energy/MMD) on LODO-legal train sets.
3. Distance of fuse-trial summary → fuse-ball vs hp30-trial summary → hp30-ball; hard pick or soft `sigmoid(T·(d_h−d_f)/(d_h+d_f))`.
4. Select among 42 candidates by mean **inner Acc then H** (never AASD/Carta).

## Gate selection (LODO train only)

| Candidate | Best inner Acc / H | Notes |
|---|---|---|
| **const_fuse** | **91.13 / 0.9453** | **Selected headline** |
| soft\|mom4\|mmd\|T1 | 88.23 / 0.9290 | Best non-const |
| soft\|mom4\|mahal\|T1 | 87.29 / 0.9236 | |
| hard * | ≤74.31 | Often → hp30; kills Acc |
| const_hp30 | 68.14 / 0.7787 | Floor |

Honest selector → **const_fuse** (same endpoint as framewise emis-LL / MoE Acc@0.994). Soft whole-trial MMD that admits hp30 loses ~3 inner Acc points.

## LODO (preset; selected = const_fuse)

| Held-out | gate H | gate Acc % | frac→hp30 |
|---|---:|---:|---:|
| AVGC | **0.8100** | **75.14** | 0.0% |
| DTU | 0.9007 | 89.23 | 0.0% |
| KUL | 0.8749 | 82.20 | 0.0% |
| UHD | **0.8580** | **80.10** | 0.0% |
| USTC | 0.9188 | 86.25 | 0.0% |
| **mean** | **0.8725** | **82.58** | **0.0%** |

≡ fuse w=0.5.

## External (preset)

| Set | gate (=fuse) H/Acc | linear_hp30 | **% trials → hp30** |
|---|---|---|---:|
| AASD | 0.6155 / **50.77** | **0.6422 / 53.12** | **0.0%** (n=900) |
| Carta2026 | 0.5349 / 47.29 | **0.6520 / 60.54** | **0.0%** (n=480) |

Δ AASD Acc vs 53.12: **−2.35**.

### Diagnostic (not selected): best non-const `soft|mom4|mmd|T1`

| | H / Acc | frac→hp30 |
|---|---|---:|
| LODO mean | 0.8778 / 82.33 | ~74.6% |
| AASD | 0.6349 / **51.66** | **34.4%** |
| Carta | 0.5903 / 52.94 | 51.0% |

Forces some AASD trials onto hp30 (34%) and lifts Acc to 51.66 — still **below** linear_hp30 53.12 and loses honest LODO Acc vs `const_fuse`.

## Targets

| Target | Result |
|---|---|
| AVGC H≥0.85 / Acc≥78 | miss (0.8100/75.14); same as fuse |
| UHD H≥0.85 | **met** (0.8580); same as fuse |
| AASD Acc>60 with H>0.63 | miss (0.6155/50.77); below linear_hp30 53.12 |
| Carta vs linear_hp30 | moved away (0.5349/47.29) |

## Verdict

Whole-trial summary→train-ball MMD/energy assignment **does not beat fuse** under honest LODO selection: grid collapses to `const_fuse` again. Hard distance picks behave like hp30 and destroy train Acc; soft MMD mixes but still lose inner Acc vs pure fuse. Portfolio unchanged: fuse for LODO / `linear_hp30` for external. **Do not rerun** this whole-trial fuse↔hp30 summary-ball family (incl. forced non-const soft MMD).

## NEXT IDEA

Abandon unlabeled fuse↔hp30 *gates* that select on LODO Acc (they always prefer fuse). Prefer (a) **ms-feat-coral** / higher-dim adaptation already in flight, or (b) an explicit **two-system portfolio** (fuse submission for train mean; `linear_hp30` for external) if the challenge allows separate readouts — unlabeled 1-D stream choice cannot close the AASD Acc gap to 60.
