R Package: eegwhiten
Milestone:
Package: eegwhiten
Title: Whitening Transforms for EEG Covariance Matrices
Language: R
License: MIT
Overview
eegwhiten provides whitening transforms for EEG and multichannel feature data. The package is built around a reusable fit/transform API: estimate a whitening model on training data, apply the same transform to validation or test data, and inspect whether the transformed covariance is well conditioned.
Toolkit Role
eegwhiten is the preprocessing and stabilization layer of the toolkit. It is useful before distance-based classifiers, covariance analysis, tangent-space mapping, domain adaptation, and cross-session alignment.
EEG features -> whitening / recentering -> stable distances and covariance geometry
Main Capabilities
- Whitening methods: PCA, PCA-cor, ZCA, ZCA-cor, SVD, and Cholesky.
- Reusable model objects with
predict(), inverse transforms, diagnostics, and incremental updates. - Shrinkage covariance estimation, including Ledoit-Wolf and OAS options.
- Robust covariance estimators and automatic tuning helpers.
- Cross-session tools: Euclidean alignment, per-domain recentering, and relative/generalized-eigenvalue whitening.
- Riemannian helpers for covariance matrices, tangent-space mapping, and inverse tangent reconstruction.
Example Use
library(eegwhiten)
model <- whiten_model(
X_train,
method = "PCA",
var_threshold = 0.95,
lambda = "auto",
lambda_method = "oas"
)
Z_test <- predict(model, X_test)
diagnostics <- check_whitening(Z_test)