Skip to content

Riemannian ASR produces incorrect component selection due to mismatched eigenvalues/eigenvectors in nonlinear_eigenspace #99

Description

@dvanmoorselaar

Environment

  • meegkit 0.1.9, Python 3.11, pymanopt installed

Description

ASR with method='riemann' consistently applies reconstruction to the wrong channels — the lowest-variance (clean) ones instead of the highest-variance (noisy) ones. Providing clean calibration data to fit() has no effect on the output.

Steps to reproduce

import numpy as np
from meegkit.asr import ASR

rng = np.random.default_rng(42)
n_samples, sfreq = 50000, 256.0

clean = rng.normal(0, 5e-6, (4, n_samples))
clean[0] += rng.normal(0, 30e-6, n_samples)   # ch 0 noisy
clean[3] += rng.normal(0, 30e-6, n_samples)   # ch 3 noisy
cal = clean[:, :10000]

for method in ("euclid", "riemann"):
    asr = ASR(sfreq=sfreq, cutoff=5.0, method=method)
    asr.fit(cal)
    rec = asr.transform(clean)
    diff = np.abs(clean - rec)
    thresh = np.median(diff, axis=1) + 3 * np.median(
        np.abs(diff - np.median(diff, axis=1, keepdims=True)), axis=1)
    print(f"{method}: {(thresh * 1e6).round(2).tolist()}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions