# Preprocessing agent results

Two new pipelines. The classifier was left as the published direct classifier (`vlaai_ws`, 10 s window, 3 blocks, sw2 augmentation, SparrKULee init, Fuglsang extra training, seed 20270101 for LODO). No transformer block was changed.

H is the official harmonic mean (fraction). Acc is subject-mean sample accuracy after the HMM (percent). Train numbers are leave-one-dataset-out on AVGC, DTU, KUL, UHD, USTC. External numbers are real switches. The external headline uses p_stay 0.998, the safe value already chosen on the training stack. Emissions come from the matching LODO folds only.

Targets: train mean H >= 0.85 and Acc >= 78; AASD and Carta each H > 0.63 and Acc > 60. **Not met.**

## Run 1 — surface Laplacian (`lap_eaP`) — worse than the current classifier

Nearest-neighbour Hjorth Laplacian on the 58-channel montage, then causal Euclidean alignment with the Fuglsang prior mapped by L R L^T (n0 5 s, tau 60 s). Same-time spatial mix, no second z-score.

| Set | H | Acc | L | SDT (s) |
|---|---:|---:|---:|---:|
| AVGC | 0.703 | 67.48 | | |
| DTU | 0.819 | 72.56 | | |
| KUL | 0.785 | 72.75 | | |
| UHD | 0.771 | 71.08 | | |
| USTC | 0.779 | 69.84 | | |
| **Train mean** | **0.771** | **70.74** | 0.850 | 7.75 |
| AASD (p_stay 0.998) | 0.629 | 51.72 | 0.803 | |
| Carta (p_stay 0.998) | 0.634 | 57.78 | 0.703 | |

Files: `results/direct_clf__lap_eaP_w10b3_ptSPK_aug-sw2.json`, `results/research/ext_clf_{AASD,Carta2026}_lap_w10b3_s0.json`, `experiments/lap_eap_run.log`.

## Run 2 — causal 7 Hz speech-band low-pass (`lp7_eaP`) — best of these two

Causal Butterworth low-pass at 7 Hz on EEG and envelopes (keeps delta/theta, cuts the alpha skirt still passed by the order-2 9 Hz cutoff), then the same causal EA as `eaP_n5_t60`. No second filtfilt and no second z-score.

| Set | H | Acc | L | SDT (s) |
|---|---:|---:|---:|---:|
| AVGC | 0.711 | 67.40 | 0.752 | 16.45 |
| DTU | 0.834 | 74.63 | 0.944 | 2.68 |
| KUL | 0.815 | 74.98 | 0.892 | 5.70 |
| UHD | 0.773 | 72.95 | 0.823 | 8.25 |
| USTC | 0.809 | 72.45 | 0.916 | 3.96 |
| **Train mean** | **0.788** | **72.48** | 0.865 | 7.41 |
| AASD (p_stay 0.998) | 0.624 | 51.11 | 0.801 | 13.57 |
| Carta (p_stay 0.998) | 0.634 | 58.02 | 0.699 | 21.00 |

Files: `results/direct_clf__lp7_eaP_w10b3_ptSPK_aug-sw2.json`, `results/research/ext_clf_{AASD,Carta2026}_lp7_w10b3_s0.json`, `experiments/lp7_eap_run.log`.

Same classifier on the existing prep `eaP_n5_t60` (one seed, not retrained here): train mean H 0.785 Acc 72.14; AASD H 0.629 Acc 51.68; Carta H 0.640 Acc 58.26. The 7 Hz low-pass is about the same on the five training sets and does not raise AASD or Carta accuracy.

## Methods skipped because they were already used

From `ALREADY_TRIED.md` section C2 and `config.yaml`: organiser 1–9 Hz filtfilt, CAR, full-trial z-score, causal running z-score, FFT band-pass (1–9 and 1–15 Hz), 3-band spectral equalisation, gamma envelopes, delta/theta phase channels, causal temporal whitening and spectral recolouring, the Euclidean-alignment grid (including the population prior `eaP_n5_t60` and carry-across-trials `mat_reac`), channel drop / gain / noise augmentation, and EEG–speech lag jitter of ±60 ms. Channel-wise z-score per recording is the existing full-trial z-score, so it was not repeated.

## Real-switch event-lock and causal posterior experiment

### Dataset provenance and what LODO means

The five LODO datasets are not interchangeable recordings. Each outer fold trains on four source datasets and holds the fifth out. The official transformer evidence is generated at 32 Hz from 1-second windows every 0.25 seconds, with a 0.75-second lookahead budget. Standard LODO switch scoring applies a **synthetic switch schedule** to those fold streams. It does not mean that each dataset contains observed within-trial brain-attention switches.

| Dataset key | Corpus | Subjects | Trials | Source fs | Median trial duration | Genuine within-trial direction-label changes in CND |
|---|---|---:|---:|---:|---:|---:|
| AVGC | KUL-AV-GC | 13 | 99 | 128 Hz | 600 s | 99 (one per indexed trial) |
| DTU | DTU | 18 | 1,080 | 128 Hz | 50 s | 0 |
| KUL | KUL2016 | 16 | 320 | 128 Hz | 123.9 s | 0 |
| UHD | KUL-UHD | 30 | 120 | 128 Hz | 391 s | 0 |
| USTC | USTC | 18 | 360 | 128 Hz | 120 s | 0 |

Only AVGC provides a genuine direction transition in this corpus metadata; the other LODO switch evaluations use synthetic swaps. AASD provides 18 subjects / 900 active trials, with median 5 real keypress switches per trial. Carta2026 provides 24 subjects / 480 cued-switch trials, with median 6 events per trial. AASD's `mat` cache starts from the supplied 128-Hz processed MAT; Carta's starts from 64-Hz ICA-cleaned CND data (0.5–20 Hz). Both are then mapped to the 58-channel montage, filtered 1–9 Hz, resampled to 32 Hz, CAR-referenced, full-trial z-scored and trimmed. `eaP_n5_t60` adds causal Euclidean alignment from a population prior. Thus the event-lock below compares **base pre-EA versus EA caches**, not unfiltered acquisition voltage. The original AASD CNT is present but was not decoded in this run because MNE is unavailable; Carta's distributed CND source is already ICA-cleaned.

### EEG tracking around real switches

Analysis: 1-second windows, 0.25-second hop, centered around annotated real switches. The tracking measure is the difference between absolute EEG–envelope correlation for the currently attended and unattended streams. Confidence intervals bootstrap subjects, not individual windows/events.

| Dataset | Prep | Mean pre-switch margin | Mean post-switch margin | Post − pre, 95% subject bootstrap CI |
|---|---|---:|---:|---:|
| AASD | `mat` | 0.00056 | −0.00034 | −0.00091 [−0.00311, 0.00153] |
| AASD | `eaP_n5_t60` | 0.00025 | 0.00026 | 0.00002 [−0.00138, 0.00160] |
| Carta2026 | `mat` | −0.00024 | 0.00098 | 0.00122 [−0.00101, 0.00352] |
| Carta2026 | `eaP_n5_t60` | −0.00012 | 0.00138 | 0.00150 [0.00055, 0.00258] |

The attended/unattended tracking separation is small in absolute units. The Carta EA interval excludes zero in this descriptive analysis, but that is not evidence that EA improves switch detection or a causal neural mechanism. AASD does not show a reliable pre/post tracking change here. Its RMS plot has a narrow peak at the keypress timestamp; motor/keypress artifact is a plausible explanation and must be separated from attention-related EEG before interpreting that transient. Per-event CSVs include delta/theta/alpha power and EEG RMS for further inspection.

### Causal transition-posterior test

`causal_ds_temp.py` now exposes the two-state HMM forward posterior P(attend stream 1) and tests a causal EMA on that probability. The official binary output remains `P > 0.5`; tau is selected using inner LODO only for each outer fold. For external evaluation, one tau is selected by five-fold corpus validation before AASD/Carta labels are scored.

| Metric | Baseline HMM / tau 0 | Nested posterior EMA |
|---|---:|---:|
| LODO mean H / Acc | 0.8821 / 83.36 | 0.8821 / 83.36 |
| AVGC H / Acc | 0.8226 / 75.54 | 0.8226 / 75.54 |
| AASD H / Acc | 0.6208 / 51.06 | 0.6208 / 51.06 |
| Carta H / Acc | 0.5494 / 49.14 | 0.5494 / 49.14 |
| Selected tau | — | 0 s on all five outer folds and external corpus validation |

The tau grid was `{0, 0.25, 0.5, 1, 2, 4, 8}` seconds. The LODO selector chose tau 0 for every outer fold; extra probability EMA therefore did not improve H, Acc, L, SDT or miss rate. AASD/Carta have 4,600/2,880 annotated switches; both 20% and 80% posterior crossings were measurable inside the event window for 3,028/2,091 of them. Median 20–80% posterior rise is 0 s at the 0.25-second sampling grid (mean 0.28 s AASD, 0.56 s Carta). Many measured transitions cross both thresholds in one grid step, while other switches do not reach both thresholds in-window. The event-mean posterior stays close to 0.5 for AASD; Carta rises more gradually and crosses 0.5 about 13 s after the annotated cue. These are model-output response times, not neural transition durations: keypress/cue timing, possible button-press artifact, the model's 0.75-second lookahead budget and 1-second evidence window affect alignment. The result supports exposing posterior trajectories for inspection, but **does not support claiming that added smoothing improved hard decisions**.

Artifacts: `results/research/attention_transition_dataset_profile.csv`, `attention_transition_event_locked.csv`, `attention_transition_subject_summary.csv`, `attention_transition_posterior_event_locked.csv`, `attention_transition_posterior_event_summary.csv`, and the two `attention_transition_*_event_locked.png` plots. Model output: `results/research/causal_ds_temp.json` and `multi_agent_opt/results_causal_ds_temp.md`.
