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

Error calculating d_prime #54

Open
ldclaar opened this issue Oct 27, 2020 · 1 comment
Open

Error calculating d_prime #54

ldclaar opened this issue Oct 27, 2020 · 1 comment

Comments

@ldclaar
Copy link

ldclaar commented Oct 27, 2020

I'm running into the following error when I run the quality_metrics module (using the master branch) on a dataset I collected:

d_prime = lda_metrics(all_pcs, all_labels, cluster_id) (from line 278 in metrics.py)
ValueError: n_components cannot be larger than min(n_features, n_classes - 1).

I've done a little digging and, from what I can tell, it is failing on clusters that do not have any other units_in_range. One way to avoid the problem is to increase the num_channels_to_compare in the quality_metrics_params. Is this a good solution though? I know this will increase the number of neighboring units each cluster is compared to. Another possible solution would be to set a d_prime value (NaN or some high value?) if there are no units_in_range. Does this make sense? I could also be misdiagnosing the problem, any ideas?

@jsiegle
Copy link
Collaborator

jsiegle commented Oct 28, 2020

I think the second option makes the most sense. If there's only one unit on a segment of the probe, LDA and other PCA-based metrics are not defined. I would recommend adding an extra check on line 272 of metrics.py to test if len(units_in_range) > 1.

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

No branches or pull requests

2 participants