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

Regularize whitening #2744

Merged
merged 46 commits into from
Jul 5, 2024
Merged

Conversation

yger
Copy link
Collaborator

@yger yger commented Apr 23, 2024

Add an option to use regularized whitening

@zm711 zm711 added the preprocessing Related to preprocessing module label Apr 25, 2024
@DradeAW
Copy link
Contributor

DradeAW commented Jun 5, 2024

@samuelgarcia @alejoe91 It would be great if this could be merged before the 'rc' release :)

@alejoe91 alejoe91 added the hackathon-24 Contributions during the SpikeInterface Hackathon May 24 label Jun 5, 2024

n_jobs = int(n_jobs * os.cpu_count())
regularize_kwargs["n_jobs"] = n_jobs
estimator = sklearn.covariance.GraphicalLassoCV(**regularize_kwargs)
Copy link
Member

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 ?

Copy link
Collaborator Author

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...

Copy link
Member

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 ?

Copy link
Collaborator Author

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

@@ -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):
Copy link
Member

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 ?

Copy link
Collaborator Author

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
Copy link
Member

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 ?

Copy link
Collaborator Author

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

@samuelgarcia samuelgarcia added this to the 0.101.0 milestone Jun 12, 2024
@samuelgarcia
Copy link
Member

Merci.

@samuelgarcia samuelgarcia merged commit 9703af1 into SpikeInterface:main Jul 5, 2024
15 checks passed
@yger yger deleted the regularize_whitening branch July 5, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hackathon-24 Contributions during the SpikeInterface Hackathon May 24 preprocessing Related to preprocessing module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants