Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance 'lwf', 'mcd', 'oas' and 'sch' covariance estimator to process complex inputs #274

Merged
merged 13 commits into from Dec 15, 2023

Conversation

gabelstein
Copy link
Contributor

As noted in #204, this implements general complex covariance estimation described here.

I put the transformation in the individual estimators like _oas, _lwf etc., that made most sense to me.

What do you thin, @qbarthelemy?

pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
Copy link
Member

@qbarthelemy qbarthelemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for this contribution which solves a crucial issue!

pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
Comment on lines 221 to 252
if not is_real_type(X):
raise ValueError("Input must be real-valued.")
iscomplex = np.iscomplexobj(X)
if iscomplex:
X = np.concatenate((X.real, X.imag), axis=0)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sylvchev , do you think that sch estimator could be easily generalized to complex-valued input?

pyriemann/utils/covariance.py Outdated Show resolved Hide resolved
gabelstein and others added 5 commits December 15, 2023 08:54
Co-authored-by: Quentin Barthélemy <q.barthelemy@gmail.com>
add decorator,
revert changes to m estimators
revert list comprehensions
@gabelstein
Copy link
Contributor Author

Thank you for the suggestions, @qbarthelemy and @agramfort.
I wrote a small decorator, but this is the first time I used this so someone should probably check if it's correctly written (and documented).
Also, I added a test for the decorator (which also tests the method from the paper for np.cov). Not sure if it makes sense like that so someone who knows more about testing please look into this.

.gitignore Outdated Show resolved Hide resolved
Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qbarthelemy I let you merge if happy

thx @gabelstein

@qbarthelemy qbarthelemy changed the title General complex covariance estimation Enhance 'lwf', 'mcd', 'oas' and 'sch' covariance estimator to process complex inputs Dec 15, 2023
Copy link
Member

@qbarthelemy qbarthelemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @gabelstein for this great improvement !

@qbarthelemy qbarthelemy merged commit e6ef5af into pyRiemann:master Dec 15, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants