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

"mean of empty slice" in spearman correlation calculation #73

Open
timokau opened this issue Nov 14, 2019 · 2 comments
Open

"mean of empty slice" in spearman correlation calculation #73

timokau opened this issue Nov 14, 2019 · 2 comments
Labels
bug Something isn't working Priority: Low

Comments

@timokau
Copy link
Collaborator

timokau commented Nov 14, 2019

During the tests, numpy complains about a "mean of empty slice". That happens because the calculation of the spearman correlation filters the labels it applies to as follows:

if len(np.unique(r2)) == len(r2):

And then averages its results:

return np.nanmean(np.array(rho))

Which may be empty (or consist of only NaNs) due to the previous filter. What is the intention behind that filter?

CC @prithagupta

@timokau timokau mentioned this issue Nov 14, 2019
7 tasks
@kiudee
Copy link
Owner

kiudee commented Nov 18, 2019

The filter is applied to remove instances for which there are ties in the prediction. Ties are problematic in the calculation of Spearman correlation and can cause a non-minor bias. But I also think that the current state of the code could be improved - at the very least the user should get a warning.

Here is a paper discussing several methods on how to deal with ties: https://www.tandfonline.com/doi/full/10.1080/02664763.2015.1043870

@prithagupta
Copy link
Collaborator

@kiudee @timokau even the script version takes ties into consideration. But we need to check that implementation on how they do it. As far as I remember we removed it because it was not correct or efficient ways of evaluating spearman correlation.

@kiudee kiudee added bug Something isn't working Priority: Low labels Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Low
Projects
None yet
Development

No branches or pull requests

3 participants