-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.spatial
Milestone
Description
Yule dissimilarity of two identical and constant vectors results in a divide by zero.
Reproducing code example:
from scipy.spatial.distance import yule
>>> from scipy.spatial.distance import yule
>>> yule([1, 1, 0], [1, 1, 0])
0.0
>>> yule([1, 1, 1], [1, 1, 1])
/home/peter/git/scipy/build/testenv/lib/python3.7/site-packages/scipy/spatial/distance.py:1299: RuntimeWarning: invalid value encountered in double_scalars
return float(2.0 * ntf * nft / np.array(ntt * nff + ntf * nft))
nan
Wolfram alpha confirms, the result should be zero:
https://www.wolframalpha.com/input/?i=YuleDissimilarity%5B%7B1%2C+1%2C+1%7D%2C+%7B1%2C+1%2C+1%7D%5D
Scipy/Numpy/Python version information:
1.7.0.dev0+6673cb8 1.20.1 sys.version_info(major=3, minor=7, micro=8, releaselevel='final', serial=0)
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.spatial