Skip to main content

Local Geometric Consistency + Riemannian Centering Transformation for cross-subject EEG transfer learning

Project description

LGC-RCT — Local Geometric Consistency + Riemannian Centering Transformation

Calibration-free cross-subject EEG transfer learning for passive Brain-Computer Interfaces.

Licona Muñoz, R. et al."Local Geometric Consistency for Cross-Subject EEG Transfer Learning" NAT 2026, Berlin. (citation forthcoming)


What is LGC-RCT?

LGC-RCT is a calibration-free method for cross-subject EEG transfer learning designed for passive BCI applications. It combines two components:

  • RCT (Riemannian Centering Transformation) [1]: a transfer learning method that re-centers covariance representations across domains to the identity matrix. Domains are treated as independent prior to the re-centering and classification phases.

  • LGC (Local Geometric Consistency) (proposed): a local-geometry phase applied prior to RCT. For each covariance matrix, a neighborhood including its immediate temporal neighbors on both sides is defined. A local Riemannian mean is computed over this neighborhood, and the matrix is replaced by this local estimate. The parameter K controls the degree of local geometric consistency enforced between neighboring window-level covariance matrices.

In this work, we investigate whether enforcing local geometric consistency among neighboring covariance matrices prior to RCT improves cross-subject workload classification.

Pipeline

 Raw EEG (N channels)
        │
        ▼
 ┌─────────────────────────────────────────────────────────────┐
 │  Band-pass filter + Sliding windows                         │
 │  (dataset-specific band · 4 s windows · 50% overlap)        │
 └─────────────────────────────────────────────────────────────┘
        │  (N_epochs, C, T)
        ▼
 ┌─────────────────────────────────────────────────────────────┐
 │  Covariance matrix estimation                               │
 │  Ledoit-Wolf · pyriemann Covariances('lwf')                 │
 └─────────────────────────────────────────────────────────────┘
        │  (N_epochs, C, C)  SPD matrices
        ▼
 ╔═════════════════════════════════════════════════════════════╗
 ║  LGC — Local Geometric Consistency          [proposed]      ║
 ║  Riemannian moving average over K temporal neighbors        ║
 ║  Block-aware: smoothing does not cross class boundaries     ║
 ╚═════════════════════════════════════════════════════════════╝
        │  (N_epochs, C, C)  smoothed SPD matrices
        ▼
 ┌─────────────────────────────────────────────────────────────┐
 │  RCT — Riemannian Centering Transformation                  │
 │  TLCenter: re-centers each domain to the identity matrix    │
 └─────────────────────────────────────────────────────────────┘
        │
        ▼
 ┌─────────────────────────────────────────────────────────────┐
 │  MDM classifier (with geodesic filtering)                   │
 │  Trained on source domains only · target labels never used  │
 └─────────────────────────────────────────────────────────────┘
        │
        ▼
  Decision rule — Class 0 or Class 1

Key properties

  • Calibration-free: no labeled data from the target subject required
  • Standard API: follows the (X, y, domains) convention of pyriemann transfer learning
  • Paradigm-agnostic: validated on mental workload and affective state classification (preliminary)

Installation

pip install lgc-rct

For exact reproducibility of published results:

pip install -r requirements-freeze.txt
pip install lgc-rct

Quick Start

from lgcrct import LGCRCTPipeline, run_loso

# X : np.ndarray, shape (N, C, T) — bandpass-filtered EEG epochs
# y : np.ndarray, shape (N,)      — class labels {0, 1}
# domains : np.ndarray, shape (N,) — subject IDs

# LGC-RCT (proposed method)
pipe = LGCRCTPipeline(half_window=10, cov_estimator="lwf")
pipe.fit(X, y, domains, target_domain="subject_01")
y_pred = pipe.predict(X_test, y_test, domains_test)

# Full LOSO evaluation
results = run_loso(X, y, domains, half_window=10, cov_estimator="lwf")

Input format

X       : np.ndarray (N, C, T)   bandpass-filtered EEG epochs
y       : np.ndarray (N,)        class labels {0, 1}
domains : np.ndarray (N,)        subject IDs (str or int)

Recommendation: apply sliding-window segmentation before calling LGC-RCT. LGC smoothing relies on temporal neighbors within each class segment — more windows per segment means richer temporal structure and stronger smoothing effect. A 4-second window with 50% overlap (2-second step) at 128 Hz is a validated configuration.


Validated Results

Mental Workload — Team Metrics dataset (private, TNO)

34 pilots, UAV supervision task, binary workload classification, LOSO, 128 Hz.

Method Alpha ACC Theta ACC Calib-free?
MDM 50.56 ± 1.63 51.34 ± 2.15
RCT 57.74 ± 2.56 57.94 ± 3.46 YES
LGC-RCT K=1 63.11 ± 4.04 60.61 ± 3.42 YES
LGC-RCT K=10 77.73 ± 6.39 73.91 ± 6.05 YES

As reported in NAT26 Berlin proceedings.

Affective State Classification — DEAP dataset (preliminary)

32 subjects, emotion recognition, binary classification, LOSO, 128 Hz, 15–36 Hz.

Task Method ACC Calib-free? Status
Valence LGC-RCT K=10 79.52 ± 5.87 YES preliminary
Arousal LGC-RCT K=10 75.51 ± 5.68 YES preliminary

These results are preliminary and obtained without any dataset-specific tuning. The method configuration (K=10, cov_estimator='lwf' (Ledoit-Wolf covariance estimator)) is identical to the one used for workload; only the frequency band differs (15–36 Hz for DEAP vs. alpha/theta for Team Metrics). They suggest that LGC-RCT generalizes across passive BCI paradigms. Full analysis forthcoming.


Repository Structure

lgc-rct/
├── lgcrct/                                        # Installable Python package
│   ├── smoothing.py                               # LGC: block-aware Riemannian moving average
│   ├── pipeline.py                                # LGCRCTPipeline: fit / predict / transform
│   └── evaluation.py                              # run_loso: LOSO cross-subject evaluation
├── demos/
│   └── 02_demo_deap.py                            # Demo on DEAP public dataset
├── experiments/                                   # Requires Team Metrics dataset (private, TNO)
│   └── lgc_rct_loso.py                            # Full LOSO experiment script
├── data/
│   └── FORMAT.md                                  # Dataset format and download instructions
└── results/
    ├── loso_34pilots_published.csv                # NAT26 Berlin — K ablation (alpha & theta)
    ├── LGC-RCT_K10_DEAP_VALENCE_15-36Hz_LOSO.csv # DEAP valence (preliminary)
    └── LGC-RCT_K10_DEAP_AROUSAL_15-36Hz_LOSO.csv # DEAP arousal (preliminary)

Reproducibility

The LGC-RCT pipeline is fully deterministic: Ledoit-Wolf covariance estimation, Riemannian mean computation, and RCT alignment all have unique, closed-form or convergent solutions on the SPD manifold. LOSO partitioning is determined entirely by subject IDs. No random seed is required — results are exactly reproducible given the same data and dependency versions (see requirements-freeze.txt).

This property extends to third-party use: researchers who apply lgc-rct to their own datasets and publish results can guarantee exact replication by any laboratory, without dependence on random initialization, hardware, or number of runs.

Dataset availability

The Team Metrics dataset is proprietary (TNO, Netherlands) and cannot be shared. To access it for replication of the NAT26 Berlin results, contact Anne-Marie Brouwer (TNO).

The DEAP demo (demos/02_demo_deap.py) runs on the publicly available DEAP dataset. See data/FORMAT.md for download instructions.


Dependencies

Package Version
Python ≥ 3.9
numpy ≥ 1.26.4
pyriemann ≥ 0.9
scikit-learn ≥ 1.6.1

experiments/lgc_rct_loso.py additionally requires gumpy for EEG bandpass filtering. gumpy is not available on PyPI — install from: https://github.com/gumpy-bci/gumpy Always pass fs=128 explicitly (gumpy defaults to fs=256).


Citation

If you use this method, please cite the paper:

@inproceedings{licona2026lgcrct,
  title     = {Local Geometric Consistency for Cross-Subject {EEG} Transfer Learning},
  author    = {Licona Mu{\~n}oz, Ricardo and
               Guetschel, Pierre and
               Bruin, Juliette and
               Yilmaz, Efecan and
               Brouwer, Anne-Marie},
  booktitle = {Proceedings of the Fifth Neuroadaptive Technology Conference (NAT'26)},
  year      = {2026},
  note      = {Berlin, Germany}
}

Paper DOI will be added upon proceedings publication.

If you use this software specifically, please also cite the software release:

@software{licona2026lgcrct_software,
  author    = {Licona Mu{\~n}oz, Ricardo and
               Guetschel, Pierre and
               Bruin, Juliette and
               Yilmaz, Efecan and
               Brouwer, Anne-Marie},
  title     = {lgc-rct: Local Geometric Consistency + Riemannian Centering Transformation},
  year      = {2026},
  publisher = {Zenodo},
  version   = {v0.1.1},
  doi       = {10.5281/zenodo.19225509}
}

References

[1] Zanini, P., Congedo, M., Jutten, C., Said, S., & Berthoumieu, Y. (2018). Transfer Learning: A Riemannian Geometry Framework With Applications to Brain–Computer Interfaces. IEEE Transactions on Biomedical Engineering, 65(5), 1107–1116. https://doi.org/10.1109/TBME.2017.2742541


License

MIT License — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lgc_rct-0.1.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lgc_rct-0.1.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file lgc_rct-0.1.1.tar.gz.

File metadata

  • Download URL: lgc_rct-0.1.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for lgc_rct-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0ca1a5fefdd0b2db7260e9d61b038d9ebea4ea584b7b7d773af1e884627de1f3
MD5 e0d3ff40e2e00130e1b93595e93182ca
BLAKE2b-256 ed994e7b8074860d97d4cb5858e943650a1bcccea35ebe779044e8e02ed04362

See more details on using hashes here.

File details

Details for the file lgc_rct-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lgc_rct-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.16

File hashes

Hashes for lgc_rct-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 216121581f16df15ee6731708f41a188dbab2c08267f8312159e650cef24804a
MD5 f0b12449689c5dc12cb8f161d817c3a9
BLAKE2b-256 c0d7212a823c400d36ee39c4f8fdd1078850840fd3fb641d452ab01fed894cc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page