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
unexpected behavior from scipy.spatial.distances with different dtypes (uint8) #9961
Comments
* xcor notebook version * morph_xcor_viz * refactor to singleunit.py * euclidean, correlation, cosine * pdist * remove unused blocked functions * resource usage * cast to float due to scipy/scipy#9961 * updated notebook * rename notebook and add spect jointplot * update notebook * range for py3 * hued scatterplot * OLS regression
I can submit a PR for either of these solutions if a maintainer comments which is preferable. |
Hmm. Most distance functions (including
Which converts to float arrays for array-like (list etc) inputs. However it preserves dtypes of arrays that are passed in.
It looks like a similar issue was reported for it and fixed in commit 05378cb. That approach should be extended to all/most functions I think. The right approach is probably:
|
My issue is about unexpected behavior from scipy.spatial.distance.cosine and scipy.spatial.distance.euclidean with different dtypes, in particular here is an example using uint8.
Cosine and euclidean return a float and nowhere does it mention that they expects a float. This doesn't seem to be an issue with correlation.
Reproducing code example:
Which returns:
This should be an easy fix of casting to float beforehand because I doubt anyone would be using these functions this way meaningfully... Otherwise we could add a note to the documentation that it expects a float.
Scipy/Numpy/Python version information:
The text was updated successfully, but these errors were encountered: