JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Making It Survive Contact: Nonstationarity, Domain Adaptation, and Honest Evaluation

The research-level reality of deploying deep neural decoders — closing the session-to-session gap with domain adaptation and latent stabilisation, interpreting what the network learned, and evaluating without fooling yourself.

The deployment gap

The dominant failure of deep BCI in the wild is not accuracy on paper — it is nonstationarity. Signals drift within a session and reshape across sessions and days, so a decoder frozen at calibration steadily degrades. Formally this is covariate shift: the input distribution moves while the input→intent mapping stays roughly fixed.

p_{\mathrm{tr}}(x) \neq p_{\mathrm{te}}(x), \quad p(y \mid x)\ \text{fixed} \;\Longrightarrow\; R = \mathbb{E}_{p_{\mathrm{tr}}}\!\big[\,w(x)\,L(f(x), y)\,\big], \quad w(x) = \frac{p_{\mathrm{te}}(x)}{p_{\mathrm{tr}}(x)}

The importance weight w corrects for the shift, but estimating it directly in high dimensions is hard — so practical methods align features instead.

Same story as before: in principle the importance weight w corrects for the input shift, but estimating w directly in high dimensions is impractical, so real methods instead line up the features of the two distributions.

p_{\mathrm{tr}}(x) \neq p_{\mathrm{te}}(x)
Training and test inputs no longer come from the same distribution.
w(x) = \frac{p_{\mathrm{te}}(x)}{p_{\mathrm{tr}}(x)}
The importance weight that would correct the shift, if you could estimate it.
R
The risk you actually want small at test time.

Rather than compute w, a domain-adaptation method might just rotate today's features so their mean and covariance match calibration day.

Domain adaptation and alignment

Domain adaptation realigns source and target so a decoder trained on one transfers to the other. The cheapest and often most effective move is to recenter and whiten features per session. In the Riemannian view of covariance features, you map each session's mean covariance to the identity, cancelling much of the session-to-session shift before any classifier sees the data.

\tilde\Sigma_i = \bar\Sigma^{-1/2}\, \Sigma_i\, \bar\Sigma^{-1/2}, \qquad \bar\Sigma = \text{Riemannian mean of the session's } \Sigma_i

Riemannian recentering: each session's reference covariance becomes the identity, so class geometry lines up across sessions.

Each recording session drifts, so a class that meant one thing yesterday sits somewhere else today. Recentering whitens every session by its own average covariance, so the reference becomes the identity matrix and the class geometry lines up across sessions.

\Sigma_i
The covariance matrix of trial or segment i.
\bar\Sigma
The session's average (Riemannian mean) covariance.
\bar\Sigma^{-1/2}
The whitening transform that maps \bar\Sigma to the identity.
\tilde\Sigma_i
The recentered covariance, comparable across sessions.

After Riemannian recentering, the rest state sits at the same place on every day.

For deep networks, domain-adversarial training pushes the encoder to produce features a domain classifier cannot tell apart — session or subject identity is scrubbed from the representation while the task label is preserved. A gradient-reversal layer implements the min–max in a single backward pass.

\min_{f, c}\ \max_{d}\ \mathbb{E}\big[L_{\text{task}}(c(f(x)), y)\big] \;-\; \lambda\,\mathbb{E}\big[L_{\text{dom}}(d(f(x)), s)\big]

Domain-adversarial objective: learn features good for the task but useless for guessing the domain s (session/subject).

Train the feature extractor to be great at the task but deliberately bad at revealing which session or subject the data came from. A domain detective tries to guess the domain; the features are trained to fool it, leaving only task-relevant, domain-invariant information.

f,\ c,\ d
The feature extractor, the task classifier, and the domain discriminator.
L_{\text{task}}
The task loss, which we minimise.
L_{\text{dom}}
The domain loss: features try to maximise it, the discriminator to minimise it.
\lambda
How strongly we push for domain invariance.

Features that decode movement equally well whether the data is from Monday or Friday.

Stabilised latent decoders

A powerful idea from the dynamics thread: the low-dimensional neural manifold is far more stable across days than the individual units that define it. A stabilised latent-space decoder exploits this manifold stability — it aligns today's latent space to a fixed reference manifold, so the decoder keeps working even as specific channels come and go, often with little or no relabelled data.

This ties the whole track together: the deep latent models of guide 3 supply the manifold, and the alignment machinery here keeps it fixed across time — the closest thing the field has to a decoder that installs once and keeps working, and a close cousin of self-recalibration.

Interpretability and trust

For a decoder headed toward clinical use, accuracy is not enough — you must know why it is right. Interpretability tools include occlusion and saliency maps, learned-filter visualisation (patterns, not filters), and ablations that remove a putative feature to confirm the model actually depends on neural signal.

Evaluating without fooling yourself

Deep models have more knobs and more ways to leak, so evaluation discipline matters more, not less. Use nested cross-validation for any hyperparameter or architecture search; keep every fold strictly separate so no normalisation, augmentation, or subject overlap crosses the split (data leakage); and judge against a real baseline on splits that reflect deployment.

  1. Fit ALL preprocessing (normalisation, ICA, filters, feature selection) inside the training fold only.
  2. Use nested CV: an inner loop for model selection, an outer loop for the unbiased performance estimate.
  3. Report subject-independent AND session-independent splits, not just within-session numbers.
  4. Compare against chance with a permutation test, not the 1/K intuition, and quote a classical baseline (FBCSP/Riemannian) alongside.