-
Notifications
You must be signed in to change notification settings - Fork 190
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
Regularize whitening #2744
Regularize whitening #2744
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…regularize_whitening
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@samuelgarcia @alejoe91 It would be great if this could be merged before the 'rc' release :) |
|
||
n_jobs = int(n_jobs * os.cpu_count()) | ||
regularize_kwargs["n_jobs"] = n_jobs | ||
estimator = sklearn.covariance.GraphicalLassoCV(**regularize_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could have a regularize method that can use lasso but maybe others no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I would say let's start with one...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but we could have already the regularized_method in the dict no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried something... We can pass method: "GraphicalLassoCV" or something else, and the appropriate node is created
Co-authored-by: Alessio Buccino <[email protected]>
Co-authored-by: Alessio Buccino <[email protected]>
Co-authored-by: Alessio Buccino <[email protected]>
Co-authored-by: Alessio Buccino <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@@ -41,6 +41,14 @@ def test_whiten(create_cache_folder): | |||
assert rec4.get_dtype() == "int16" | |||
assert rec4._kwargs["M"] is None | |||
|
|||
# test regularization | |||
with pytest.raises(AssertionError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see in the code wich assert is raised for this.
We should have better error than assert in this no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used what was already done, open to suggestions
W, M = compute_whitening_matrix( | ||
rec, "local", random_chunk_kwargs, apply_mean=False, radius_um=None, regularize=True | ||
) | ||
# W must be sparse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which W are you testing here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just computing W with the default regularization method
…regularize_whitening
Merci. |
for more information, see https://pre-commit.ci
Add an option to use regularized whitening